pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
38,737,328
0
<p>I'm afraid this "issue" happens in the Python (instead of pandas) side. When you have some instant values like <code>1234589890878708980.67</code> it's recognized as <code>float</code> and loses precision instantly, e.g.:</p> <pre><code>&gt;&gt;&gt; 1234589890878708980.67 1.234589890878709e+18 &gt;&gt;&gt; 1234589890878708980.67 == 1234589890878708980.6712345 True </code></pre> <p>You might try something like <code>decimal.Decimal</code>:</p> <pre><code>&gt;&gt;&gt; import decimal &gt;&gt;&gt; pd.DataFrame({'x': [decimal.Decimal('1234589890808980.67')]}) x 0 1234589890808980.67 </code></pre> <p><strong>EDITED:</strong></p> <p>OP's added a few questions in the comment.</p> <blockquote> <p>However, do I understand it right that for this method work correctly the value should be string in the first place?</p> </blockquote> <p>Yes :)</p> <blockquote> <p>What if it's float read from csv file?</p> </blockquote> <p>AFAIK Python's <code>csv</code> reader shall not have performed any type conversion, and you'll get strings that could be later converted freely. Otherwise if you're using <code>pandas.read_csv</code>, you could try setting the <code>dtype</code> and <code>float_precision</code> arguments (you could also ask pandas to load plain strings, and have the values converted later yourself).</p>
21,157,531
0
<p>Please assign an event <code>SelectedIndexChanged</code> and <code>AutoPostBack = true</code> is this is a web Application in C#</p>
34,727,540
0
<p>You should use the seamless proxy:</p> <pre><code>registry=https://npm-proxy.fury.io/AUTH_TOKEN/me/ </code></pre>
7,945,561
0
Beginning Dynamic Programming - Greedy coin change help <p>I am currently working through a book on algorithm design and came across a question whereby you must implement a greedy algorithm with dynamic programming to solve the coin change problem.</p> <p>I was trying to implement this and I just can't figure out out or make sense of the algorithm given in my book. The algorithm is as follows(with my (lack of) understanding in comments) :</p> <pre><code>Change(p) { C[0] = 0 for(i=1 to p) //cycling from 1 to the value of change we want, p min = infinity for(j=1 to k( //cyle from 1 to...? if dj &lt;=i then if(1+C[i-dj] &lt; min) then min = 1+C[i-dj] endif endif endfor C[i] = min endfor return C[p] } </code></pre> <p>And my attempt at interpreting what's going on :</p> <pre><code>/** * * @param d * currency divisions * @param p * target * @return number of coins */ public static int change(int[] d, int p) { int[] tempArray = new int[Integer.MAX_VALUE]; // tempArray to store set // of coins forming // answer for (int i = 1; i &lt;= p; i++) { // cycling up to the wanted value int min = Integer.MAX_VALUE; //assigning current minimum number of coints for (int value : d) {//cycling through possible values if (value &lt; i) { if (1 + tempArray[i - value] &lt; min) { //if current value is less than min min = 1 + tempArray[1 - value];//assign it } } } tempArray[i] = min; //assign min value to array of coins } System.out.println("help"); // :( return tempArray[p]; } </code></pre> <p>Can someone please explain to me what I am missing, how to fix this, and how this algorithm is supposed to work? Dynamic Programming seems like such a useful tool, but I cannot get my head around it. I keep thinking recursively.</p>
7,312,574
0
<p>Since I do not have an iPad, I am unable to troubleshoot this. I can confirm that the desktop version of Safari works fine though. Have you tried this on newer versions of DotNetNuke? The browser and telerik definitions are updated with every release. If you cannot upgrade for some reason, I would try upgrading just your telerik controls. For example, you can try the latest release of the <a href="http://radeditor.codeplex.com/" rel="nofollow">DNN 5 RadEditor Provider by dnnWerk</a>.</p>
29,845,004
0
<p>I managed to fix this using <code>FormData()</code>, here's how I did it:</p> <pre><code>$(document).on("click", "#PDF", function () { var table = document.getElementById("result"); var cols = [], data = []; function html() { var doc = new jsPDF('p', 'pt'); var res = doc.autoTableHtmlToJson(table, true); doc.autoTable(res.columns, res.data); var pdf =doc.output(); //returns raw body of resulting PDF returned as a string as per the plugin documentation. var data = new FormData(); data.append("data" , pdf); var xhr = new XMLHttpRequest(); xhr.open( 'post', 'upload.php', true ); //Post to php Script to save to server xhr.send(data); } html(); }); </code></pre> <p><strong>upload.php</strong></p> <pre><code>if(!empty($_POST['data'])){ $data = $_POST['data']; $fname = "test.pdf"; // name the file $file = fopen("testa/pdf/" .$fname, 'w'); // open the file path fwrite($file, $data); //save data fclose($file); } else { echo "No Data Sent"; } </code></pre> <p>The key part being <code>var pdf =doc.output();</code> where you want to get the raw pdf data. </p>
16,792,604
0
<p>There is no need to write <code>new String()</code> to create a new string. When we write <code>var x = 'test';</code> statement, it create the <code>x</code> as a string from a primitive data type. We can't attach the custom properties to this <code>x</code> as we do with object literal. ie. <code>x.custom = 'abc';</code> <code>x.custom</code> will give undefined value. Thus as per our need we need to create the object. <code>new String()</code> will create an object with <code>typeof()</code> Object and not string. We can add custom properties to this object.</p>
24,885,023
0
Hide HTML5 number input’s spin box but accepts alphanumeric characters <p>i have hidden the spinbox arrows from an input type="number" but the number restrictions doesn't work already. Hence, the numberbox now accepts alphanumeric characters.</p> <p>I used this code when i was able to hide the spinner arrows:</p> <pre><code>input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { /* display: none; &lt;- Crashes Chrome on hover */ -webkit-appearance: none; margin: 0; /* &lt;-- Apparently some margin are still there even though it's hidden */ } </code></pre> <p>hi @BenM! thanks for editing my question. Now, thanks for the idea of using <em>javascript</em> @FakeRainBrigand but it didn't work for me. </p> <p>This worked for me though. I'm using <strong>MVC</strong> and <strong>Razor</strong></p> <p>` function keeypress(e) { var unicode = e.keyCode ? e.keyCode : e.charCode</p> <pre><code> if (unicode == 8) { return; }; if (unicode == 37 || unicode == 39 || unicode == 38 || unicode == 40 || unicode == 27) { return; } else { }; if (unicode == 13) { e.preventDefault(); }; if ($.isNumeric(String.fromCharCode(unicode)) == false) { e.preventDefault(); }; } </code></pre> <p>`</p>
21,186,828
0
Numerous 499 status codes in nginx access log after 75 seconds <p>We are using nginx in a long polling scenario. We have a client that the user installs which then communicates with our server. An nginx process in that server passes that request to backends which are Python processes. The Python process holds the request for up to 650 seconds.</p> <p>In the nginx access log there are a lot of 499 entries. Logging the $request_time shows that the client times out after 75 seconds. None of the nginx timeouts are set to 75 seconds though.</p> <p>Some research suggest that the backend processes might be too slow, but there isn't a lot of activity in the servers containing the processes. Adding more servers/processes also didn't help, neither did upgrading the instance where nginx is.</p> <p>Here are the nginx configuration files.</p> <p>nginx.conf</p> <pre><code>user nobody nogroup; worker_processes 1; worker_rlimit_nofile 131072; pid /run/nginx.pid; events { worker_connections 76800; } http { sendfile on; tcp_nopush on; tcp_nodelay on; types_hash_max_size 2048; keepalive_timeout 65; server_names_hash_bucket_size 64; include /usr/local/openresty/nginx/conf/mime.types; default_type application/octet-stream; log_format combined_edit '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent" "$request_time"'; access_log /var/log/nginx/access.log combined_edit; error_log /var/log/nginx/error.log; gzip on; gzip_disable "msie6"; include /usr/local/openresty/nginx/conf.d/*.conf; include /usr/local/openresty/nginx/sites-enabled/*; } </code></pre> <p>backend.conf</p> <pre><code>upstream backend { server xxx.xxx.xxx.xxx:xxx max_fails=12 fail_timeout=12; server xxx.xxx.xxx.xxx:xxx max_fails=12 fail_timeout=12; } server { listen 0.0.0.0:80; server_name host; rewrite ^(.*) https://$host$1 permanent; } server { listen 0.0.0:443; ssl_certificate /etc/ssl/certs/ssl.pem; ssl_certificate_key /etc/ssl/certs/ssl.pem; ssl on; server_name host; location / { proxy_connect_timeout 700; proxy_buffering off; proxy_redirect off; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 10000; # something really large proxy_pass http://backend; } } </code></pre>
31,036,844
0
Scala map a Vector of tuples to vector of object <pre><code>import scala.concurrent.duration._ import scala.language.implicitConversions import scala.concurrent.{Future, Await} import scala.concurrent.ExecutionContext.Implicits.global object test extends App { case class Person(name: String, age: Int) implicit def t2p(t: (String, Int)) : Person = Person(t._1, t._2) val f:Future[Vector[(String, Int)]] = Future { Vector(("One", 1), ("Two", 2)) } val s = f.mapTo[Vector[Person]] Await.result(s.map { _ foreach { x =&gt; println(x)}}, 5.seconds) } </code></pre> <p>I am trying to convert a Vector of tuples to a Vector[Person] but the above code result in a casting exception even though there is an implicit tuple to Person conversion function?</p> <p>Exception in thread "main" java.lang.ClassCastException: scala.Tuple2 cannot be cast to example.test$Person at example.test$$anonfun$2$$anonfun$apply$1.apply(test.scala:19) at scala.collection.Iterator$class.foreach(Iterator.scala:727) at scala.collection.AbstractIterator.foreach(Iterator.scala:1157) at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) at scala.collection.AbstractIterable.foreach(Iterable.scala:54) at example.test$$anonfun$2.apply(test.scala:19) at example.test$$anonfun$2.apply(test.scala:19)</p> <p>Thanks.</p>
40,728,071
0
<p>From your MainActivity:</p> <pre><code>Intent intent = new Intent(this, mySensor.class); intent.putExtra("type", Sensor.TYPE_LIGHT); </code></pre> <p>and within your service:</p> <pre><code>@Override public IBinder onBind(Intent intent) { mSensorManager= (SensorManager) getSystemService(Context.SENSOR_SERVICE); int type = intent.getExtras().get("type"); s= mSensorManager.getDefaultSensor(type); return null; } </code></pre> <p>then you can remove:</p> <pre><code>public mySensor(int type){ ... } </code></pre> <p>and eventually the code you wrote within the <code>onCreate</code>.</p>
38,392,206
0
<p><code>match</code> accept regex for <code>url</code> value. Try:</p> <pre><code>&lt;match url="(.*?)/?awards?(\.aspx)?$" /&gt; </code></pre> <p><a href="https://www.debuggex.com/r/flpHf1GKQeQcdYCo" rel="nofollow"><img src="https://www.debuggex.com/i/7YkHJSHFyJDwo-99.png" alt="Regular expression visualization"></a></p> <p>This will match <code>award</code>, <code>award.aspx</code>, <code>awards</code> and <code>awards.aspx</code>.</p> <p><strong>Update</strong> to match <code>/test</code> as well:</p> <pre><code>&lt;match url="(.*?)/?(awards?|test)(\.aspx)?$" /&gt; </code></pre> <p><a href="https://www.debuggex.com/r/ht3kA7il9EtWmIdn" rel="nofollow"><img src="https://www.debuggex.com/i/ApnzxG8guGJkFLyV.png" alt="Regular expression visualization"></a></p> <p>It is just a <a href="http://www.regular-expressions.info/" rel="nofollow">regular expression</a>. You can match whatever you want.</p>
37,038,190
0
<p>I found another situation that could cause this to happen. I was converting a PHP function to a JS function and I had the following line:</p> <pre><code>ticks += "," . Math.floor(yyy * intMax); </code></pre> <p>Changing it to </p> <pre><code>ticks += "," + Math.floor(yyy * intMax); </code></pre> <p>solved the problem</p>
39,275,662
0
Google not crawling my pages even using history.pushState() <p>I read a lot on SEO compatibility with google crawler before starting my new project. And everything tends to say that Google know execute javascript, and so can render my template. For example <a href="http://stackoverflow.com/questions/31437815/does-html5modetrue-affect-google-search-crawlers">here</a>.</p> <p>But it seems that the crawler never execute my javascript, and the templating with some api's data isn't done. (I seen that after using the "fetch as google tool")</p> <p>I started my router like this</p> <pre><code>Backbone.history.start({pushState: true, hashChange: false}); </code></pre> <p>And so route are handled like this:</p> <pre><code>Backbone.history.navigate(url, { trigger: true }); </code></pre> <p>So I probably miss something somewhere but where ?</p>
28,289,664
0
<p>If it's an icon, why not just use a <code>float</code>?</p> <pre><code>.my-icon { display: block; width: 10px; height: 10px; float: right; } </code></pre> <p>Don't forget to set <code>overflow: hidden;</code> on the container, of course.</p>
12,832,547
0
<p>This is the very simple method that I am using to convert two individual doubles with a max of 255 to hex (firstNumber and secondNumber):</p> <pre><code>std::string hexCodes = "0123456789abcdef"; std::stringstream finalResult; finalResult &lt;&lt; hexCodes.at(floor(firstNumber/ 16)) &lt;&lt; hexCodes.at(firstNumber- (16 * (floor(firstNumber/ 16)))); finalResult &lt;&lt; hexCodes.at(floor(secondNumber/ 16)) &lt;&lt; hexCodes.at(secondNumber- (16 * (floor(secondNumber/ 16)))); std::string finalString = finalResult.str(); </code></pre> <p>I am not very good at writing code and after trawling google for a result to this problem I didn't find any solutions, so wrote this and it works...so far </p>
39,148,887
0
<p>browserify needs an absolute path to retrieve the file and it leaves that as the bundle key. The way to fix it is to use the <code>expose</code> option...</p> <p>In your build..</p> <pre><code>var dependencies = [ 'lodash', {file: './test.js', expose: 'test'}, ]; </code></pre> <p>and in app.js...</p> <pre><code>var _ = require('lodash'); var test = require('test'); </code></pre>
38,646,755
0
<p>This will match exactly the words "Mac" and "ExchangeWebServices" with anything else between them:</p> <pre><code>\bMac\b.*\bExchangeWebServices\b </code></pre> <p>Regex 101 Example: <a href="https://regex101.com/r/sK2qG1/4" rel="nofollow">https://regex101.com/r/sK2qG1/4</a></p>
15,447,942
0
<p>Here's a category on <code>UIImageView</code> that you can use to introspect the bounds of the displayed image based on the <code>UIViewContentMode</code> set on the image view:</p> <pre><code>@implementation UIImageView (JRAdditions) - (CGRect)displayedImageBounds { UIImage *image = [self image]; if(self.contentMode != UIViewContentModeScaleAspectFit || !image) return CGRectInfinite; CGFloat boundsWidth = [self bounds].size.width, boundsHeight = [self bounds].size.height; CGSize imageSize = [image size]; CGFloat imageRatio = imageSize.width / imageSize.height; CGFloat viewRatio = boundsWidth / boundsHeight; if(imageRatio &lt; viewRatio) { CGFloat scale = boundsHeight / imageSize.height; CGFloat width = scale * imageSize.width; CGFloat topLeftX = (boundsWidth - width) * 0.5; return CGRectMake(topLeftX, 0, width, boundsHeight); } CGFloat scale = boundsWidth / imageSize.width; CGFloat height = scale * imageSize.height; CGFloat topLeftY = (boundsHeight - height) * 0.5; return CGRectMake(0, topLeftY, boundsWidth, height); } @end </code></pre>
1,752,176
0
<p>Reiterating a few prior posts here (which I'll vote up)...</p> <p>How selective is TypeId? If you only have 5, 10, or even 100 distinct values across your 100M+ rows, the index does nothing for you -- particularly since you're selecting all the rows anyway.</p> <p>I'd suggest creating a column on CHECKSUM(Name) in both tables seems good. Perhaps make this a persisted computed column:</p> <pre><code>CREATE TABLE BioEntity ( BioEntityId int ,Name nvarchar(4000) ,TypeId int ,NameLookup AS checksum(Name) persisted ) </code></pre> <p>and then create an index like so (I'd use clustered, but even nonclustered would help):</p> <pre><code>CREATE clustered INDEX IX_BioEntity__Lookup on BioEntity (NameLookup, TypeId) </code></pre> <p>(Check BOL, there are rules and limitations on building indexes on computed columns that may apply to your environment.)</p> <p>Done on both tables, this should provide a very selective index to support your query if it's revised like this:</p> <pre><code>SELECT EGM.Name, BioEntity.BioEntityId INTO AUX FROM EGM INNER JOIN BioEntity ON EGM.NameLookup = BioEntity.NameLookup and EGM.name = BioEntity.Name and EGM.TypeId = BioEntity.TypeId </code></pre> <p>Depending on many factors it will still run long (not least because you're copying how much data into a new table?) but this should take less than days.</p>
9,139,214
0
Bash Shell list files using "for" loop <p>I use the following Bash Shell script to list the ".txt" files recursively under the current directory :</p> <pre><code>#!/bin/bash for file in $( find . -type f -name "*.txt" ) do echo $file # Do something else. done </code></pre> <p>However, some of the ".txt" files under the current directory have spaces in their names, e.g. "my testing.txt". The listing becomes corrupted, e.g. "my testing.txt" is listed as</p> <pre><code>my testing.txt </code></pre> <p>It seems that the "for" loop uses "white space" (space, \n etc) to separate the file list but in my case I want to use only "\n" to separate the file list.</p> <p>Is there any way I could modify this script to achieve this purpose. Any idea.</p> <p>Thanks in advance.</p>
34,139,805
0
<p>Each pass of the loop is given the value of the record containing the corresponding row of the select result set. So <code>events</code> is not visible inside the loop. In instead use <code>d_cur.position</code> to refer to that column.</p> <p>BTW, as commented to your question, you should really use the <code>lag</code> window function and get rid of the messy loop.</p> <p>As a suggestion check this query:</p> <pre><code>select idx, asset_id, asset_name, previous_name, cont_name, position, evt_time from ( select rank() over (partition by e.asset_id order by e.event_time) as idx, st_distancesphere( e.position, lag(e.position, 1, e.position) over (order by e.event_time) ) &gt;= p_separation_distance as b, t.id as asset_id, t.name as asset_name, lag(c.name, 1) as previous_name, c.name as cont_name, e.position, e.event_time as evt_time from events e inner join assets tags on t.id = e.asset_id inner join assets c on c.id = e.container_asset_id where e.event_time &gt;= p_since_date and e.event_time &lt;= p_before_date ) s where b </code></pre>
38,384,837
0
Binary Search Tree node deletion error <p>I've created my binary search tree and gave the pointer to the node which I want to delete into my <code>*p</code>. </p> <p>The delete method is supposed to be deleting the node which is pointed at by <code>*p</code> and should add the subtrees with <code>addtree</code> to my root. <code>*pBaum</code> is the pointer which points to my root.</p> <p>However im getting an error message called "conflict types" on <code>addtree</code> everytime I declare </p> <pre><code>Baum = addtree(Baum, p-&gt;right); </code></pre> <p>I also get a warning "assignment makes pointer from integer without a cast"</p> <p>My struct contains left &amp; right pointer to the subtrees and a pointer to the content.</p> <pre><code>struct tnode { int content; struct tnode *left; /* linker Teilbaum */ struct tnode *right; /* rechter Teilbaum */ }; // Deletes the node where *p is pointing at struct tnode *deletenode(struct tnode *p, struct tnode *pBaum) { struct tnode *Baum = pBaum; if ((p-&gt;left == NULL) &amp;&amp; (p-&gt;right == NULL)) { free(p); } if ((p-&gt;left == NULL) &amp;&amp; (p-&gt;right != NULL)) { Baum = addtree(Baum, p-&gt;right); free(p); } if ((p-&gt;right == NULL) &amp;&amp; (p-&gt;left !=NULL)) { Baum = addtree(Baum, p-&gt;left); free(p); } if ((p-&gt;left != NULL) &amp;&amp; (p-&gt;right !=NULL)) { Baum = addtree(Baum, p-&gt;right); Baum = addtree(Baum, p-&gt;left); free(p); } return Baum; } // Adds the Subtrees to my root struct tnode *addtree(struct tnode *top, struct tnode *p) { if (p == NULL) return top; else return addtree(addtree(addelement(top, p-&gt;content),p-&gt; right), p-&gt;left); // Adds a node to my Tree struct tnode *addelement(struct tnode *p, int i) { int cond; if (p == NULL) { p = talloc(); /* make a new node */ p-&gt;content = i; p-&gt;left =p-&gt;right =NULL; } else if (p-&gt;content == i) { return p; } else if (i &lt; p-&gt;content) /* goes into left subtree */ p-&gt;left =addelement(p-&gt;left, i); else /* goes into right subtree */ p-&gt;right = addelement(p-&gt;right, i); return p; } // Looks for the node which is supposed to get deleted and returns a pointer to it struct tnode *searchnode(struct tnode *p, int nodtodelete) { if (p == NULL) { printf("Baum ist leer oder Element nicht vorhanden \n"); return NULL; } if ( p -&gt; content == nodtodelete) { return p; } if (p-&gt;content &lt; nodtodelete) { return searchnode (p-&gt;right, nodtodelete); } if (p-&gt;content &gt; nodtodelete) { return searchnode(p-&gt;left, nodtodelete); } } } int main() { struct tnode *Baum = NULL; struct tnode *tmpPos = NULL; Baum = addelement (Baum, 32); Baum = addelement(Baum, 50); Baum = addelement(Baum, 60); tmpPos = searchnode(Baum,50); Baum = deletenode(tmpPos, Baum); } </code></pre>
23,666,955
0
Adding JButton using loop (for) does nothing <p>I'm trying to add various JButtons to a JPanel using "for" but doesn't work. No compilation or other errors. Buttons just won't appear. </p> <p>A bit of context, I create an ArryList in another class ("GestorFrigo") that gets data from DataBase, this works fine, the array has all the data and there's no problem getting back the data from the array.</p> <p>This is my code: Thanks in advance.</p> <pre><code> import gestor.GestorFrigo; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseListener; import java.util.ArrayList; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JButton; import javax.swing.JScrollBar; @SuppressWarnings("serial") public class VentanaInterior extends JFrame { private JPanel contentPane; private JButton btnPerfiles; private JButton btnAadir; private JButton btnRecetas; private JScrollBar scrollBar; private GestorFrigo frigo; private ArrayList&lt;JButton&gt; botones; private ArrayList&lt;Object&gt; boton; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { VentanaInterior frame = new VentanaInterior(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public VentanaInterior() { //Componentes setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 556, 363); setLocationRelativeTo(null); setTitle("Tu Frigorífico Inteligente"); setIconImage(new ImageIcon(getClass().getResource("img/logo.png")).getImage()); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); btnPerfiles = new JButton("Perfiles"); btnPerfiles.setBounds(0, 302, 96, 23); contentPane.add(btnPerfiles); btnAadir = new JButton("A\u00F1adir alimento"); btnAadir.setBounds(369, 302, 148, 23); contentPane.add(btnAadir); btnRecetas = new JButton("Recetas"); btnRecetas.setBounds(96, 302, 103, 23); contentPane.add(btnRecetas); scrollBar = new JScrollBar(); scrollBar.setBounds(523, 0, 17, 325); contentPane.add(scrollBar); JButton btnQueso = new JButton(); btnQueso.setBounds(24, 35, 62, 61); contentPane.add(btnQueso); frigo = new GestorFrigo(); //creamos el gestor String imagen = frigo.getArray().get(1).getImagen(); //cogemos la imagen asociada al alimento btnQueso.setIcon(new ImageIcon("src/img/"+imagen)); for(int i=0;i&lt;frigo.getArray().size();i++){ JButton boton = new JButton(); String imagen2 = frigo.getArray().get(i).getImagen(); boton.setIcon(new ImageIcon("src/img/"+imagen2)); contentPane.add(boton); } } } </code></pre>
17,488,660
0
Difference between serialize and serializeObject jquery <p>I search a lot but didn't find perfect difference between <code>serialize</code> and <code>serializeObject</code> method of jquery.</p> <p>Please help me to understand this.</p>
1,729,366
0
<p>If all of the buttons within the control will share the same appearance, why not put the property at the control level and have the property setter propogate any changes to all of the buttons? Also, using 30 individual button controls seems like lot of overhead... have you considered drawing the labels for the days and handling mouse click/hover events to determine when a particular day is clicked? </p>
10,327,502
0
How to solve a WWW/NonWWW Header Check: FAILED <p>I ran a duplicate checker for my website and got the following message</p> <blockquote> <p>WWW/NonWWW Header Check: FAILED Your site is not returning a 301 redirect from www to non-www or vice versa. This means that Google may cache both versions of your site, causing sitewide duplicate content penalties.</p> </blockquote> <p>Is this something that i should be worried about and if so how should i fix it ?</p>
19,881,428
0
Google Scripts documentation for Historical Stock Info? <p>I'm working on a google spreadsheet right now. The goal is for it to automatically get a stock open, close and change for a date in the past. </p> <p>Unfortunately, I don't understand the documentation and it doesn't seem to be working out. <a href="https://developers.google.com/apps-script/reference/finance/historical-stock-info" rel="nofollow">Here</a> is the link to the class I have to use, but I don't know how to implement it.</p> <p>Here is the code I have now for current stock data, that works. I spent a long time with the documentation and piecing together bits of code that I found. </p> <pre><code>function stockRun() { var sheet = SpreadsheetApp.getActiveSheet(); var row = 2; while (true) { if (!sheet.getRange(row, 2).getValue()) { var ticker = sheet.getRange(row, 1).getValue(); if (!ticker) break; var stockInfo = FinanceApp.getStockInfo(ticker); sheet.getRange(row, 2).setValue(stockInfo.closeyest); sheet.getRange(row, 3).setValue(stockInfo.priceopen); sheet.getRange(row, 4).setValue(stockInfo.change); sheet.getRange(row, 5).setValue(stockInfo.changepct + "%"); } row++; } } </code></pre> <p>Now that I want historical data, I'm not really sure where to go. I don't understand how I can use the class <a href="https://developers.google.com/apps-script/reference/finance/stock-info-snapshot" rel="nofollow">StockInfoSnapshot[]</a> and use the properties of it.</p> <p>Thanks so much for all your help! I know this must seem so simple, but it's really confusing to me. Once I understand how to use the class I'll be able to work on it and expand my program from there. :)</p>
33,921,385
0
<p>The other answer I gave employs the <code>::after</code> <em>pseudo-element</em> and works for inline links on a single line.</p> <p>This answer, for <strong>multi-line links</strong>, uses a similar method, but this time, the <code>::after</code> <em>pseudo-element</em> covers the entire <code>a</code> element (rather than simply being positioned at the bottom of it) and has an alternating repeating background of lines - which ends up looking like one underline for every line in the <code>a</code> element:</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>body { width: 400px; background-color: rgba(0, 0, 0, 1); } a { position: relative; display: inline-block; cursor: pointer; font-size: 16px; line-height: 20px; } a:nth-of-type(1) { color: rgba(255,0,0,1); } a:nth-of-type(2) { color: rgba(0,255,0,1); } a:nth-of-type(3) { color: rgba(127,191,255,1); } a::after { content: ""; position: absolute; top: 0; left: 0; z-index: 12; display: block; width: 400px; height: 100px; background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) 19px, currentColor 19px, currentColor 20px); opacity: 0; transition: all 0.4s ease-out; } a:hover::after { opacity: 1; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;a&gt;The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown&lt;/a&gt; &lt;a&gt;fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over &lt;/a&gt; &lt;a&gt;the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. &lt;/a&gt;</code></pre> </div> </div> </p>
34,619,915
0
Why the data from the site when access via the PHP http stream - not sent in gzip? <p>There is an internal company website .. (accessible only via local network)</p> <p>I need... when accessing this site at _http: // company_syte / some_path / some_file inside of PHP code - data (HTML, which is on this page) transmitted in a compressed format (gzip, deflate, compress ...). Now the data is transmitted without compression ..</p> <p>Although, when I look at this site in any browser (ANY!) - the page is sent by the server in a compressed format (gzip). And when referring to this site via PHP code - I get in the response header - no compression .. I do not understand why??! .. help achieve data compression for handling by PHP.</p> <p>Any other sites (both: local and from internet .. when accessed from within a PHP code context options that are shown below - give their data in a compressed form, if the site can generate compression of the code ..)</p> <p>headers in PHP prepared by stream_get_meta_data (); or get_headers ()</p> <p>That option is the context that I use when opening streams ..</p> <pre><code>define ('STREAM_USER_AGENT', 'Mozilla/5.0 (Windows NT 5.1; rv:30.0) Gecko/20100101 Firefox/30.0'); // Default context options for streams $def_context_opts = array( 'http'=&gt;array( 'method'=&gt;'GET', //'proxy'=&gt;'internal-proxy.com:80', 'user_agent' =&gt;STREAM_USER_AGENT, 'header'=&gt; //'Content-type: text/html; charset=utf-8'. //'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' . 'Accept-Encoding: compress;q=1.0, gzip;q=1.0, deflate;q=0.8, sdch;q=0.5, identity;q=0.5, *;q=0.3' . 'Accept-language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3' . 'Cookie: FastPopSessionRequestNumber=8; platform=pc' . 'Cache-Control: max-age=0 '. //'Connection: keep-alive' . 'DNT: 1' . 'Referer: http://en.wikipedia.org/', 'timeout'=&gt;85, //'request_fulluri' =&gt;true //'max_redirects'=&gt;10 ) ); //Setting up default stream context stream_context_set_default($def_context_opts); </code></pre> <p>That response header, when accessing from within a PHP code using context options that gave above</p> <pre><code>Array ( [0] =&gt; HTTP/1.1 200 OK [1] =&gt; Server: nginx [2] =&gt; Date: Tue, 05 Jan 2016 16:14:59 GMT [3] =&gt; Content-Type: text/html; charset=UTF-8 [4] =&gt; Connection: close [5] =&gt; Set-Cookie: platform=pc; expires=Tue, 10-Jan-2062 08:29:58 GMT; Max-Age=1452096899; path=/ [6] =&gt; Set-Cookie: userSession=msij61yvt3j5ryp8ky8njdlwqfxwubjc; expires=Thu, 07-Jan-2072 08:29:58 GMT; Max-Age=1767370499; path=/ [7] =&gt; Vary: User-Agent [8] =&gt; Rating: RTA-5042-1996-1400-1577-RTA [9] =&gt; Set-Cookie: RNLBSERVERID=ded1714; path=/ ) </code></pre> <p>This response header of this website, when i opened it in my browser (Firefox)</p> <pre><code>HTTP/1.1 200 OK Server: nginx Date: Tue, 05 Jan 2016 13:32:07 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Vary: User-Agent Rating: RTA-5042-1996-1400-1577-RTA Content-Encoding: gzip </code></pre> <p>This request header of browser (firefox)</p> <pre><code>GET /document_law/3060771 HTTP/1.1 Host: somehost.com User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:30.0) Gecko/20100101 Firefox/30.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate DNT: 1 Cookie: FastPopSessionRequestNumber=8; platform=pc; _ga=GA1.2.302926937.1425596941; __atuvc=0%7C50%2C4%7C51%2C30%7C52%2C8%7C0%2C2%7C1; local_storage=1; gateway=56469083; gateway_security_key=6dbfca5fe39f71d3c1ab7683b2d0bbc6; expiredEnterModalShown=1; expiredEnterModalShown_security_key=0bddb66fa85f5b04e1965b8789b44432; userSession=1bbjnu3g8k56nhaav1ansdrralaxponn; RNLBSERVERID=ded1683; performance_timing=other; FastPopSessionRequestNumber=3; playlist_reset_playlist=1; _gat=1 Connection: keep-alive Cache-Control: max-age=0 </code></pre> <p>And this is a typical response when accessing via PHP on any other site (both local and internet ..) using the context options that gave upper ..</p> <pre><code>Array ( [0] =&gt; HTTP/1.1 200 OK [1] =&gt; Server: nginx [2] =&gt; Date: Tue, 05 Jan 2016 16:22:56 GMT [3] =&gt; Content-Type: text/html; charset=UTF-8 [4] =&gt; Content-Length: 30523 [5] =&gt; Connection: close [6] =&gt; X-Powered-By: PHP/5.5.30 [7] =&gt; Expires: Thu, 19 Nov 1981 08:52:00 GMT [8] =&gt; Cache-control: private, max-age=0 [9] =&gt; Set-Cookie: xf_session=d71d38dc39f78c932be8763951b9c247; path=/; httponly [10] =&gt; X-Frame-Options: SAMEORIGIN [11] =&gt; Last-Modified: Tue, 05 Jan 2016 16:22:56 GMT [12] =&gt; Content-Encoding: gzip [13] =&gt; Vary: Accept-Encoding ) </code></pre>
18,785,535
0
<p>Pick <code>Build Path &gt; Use as Source Folder</code> an apply it to the <code>appContext</code> folder. I believe Eclipse adds an entry in the project's <code>.classpath</code> file, which is in your best interest.</p>
16,999,624
0
Can I load a new page when someone click on close button on browser? <p>Can I do it? If yes, than how? I tried unonload, but that works only when I click on an url.</p>
7,205,099
0
Online or offline function PHP <p>I'm working on a "community". And of course I would like to be able to tell if a user is online or offline. </p> <p>I've created so that when you log in a row in my table UPDATE's to 1 (default is 0) and then they're online. And when they log out they're offline. But if they don't press the Log out button, they will be online until they press that button. </p> <p>So what I would like to create is: </p> <ul> <li>After 5 minutes of inactivity the row in my database should UPDATE to 0. </li> </ul> <p>What I'm looking for is how to do this the easiest way. Should I make an mysql_query which UPDATE's the row to 1 every time a page is loaded. Or is there another way to do it? </p>
34,646,744
0
<p>The error tells you everything you need to know.</p> <p>You are simply missing a required PHP extension, <code>Mbstring</code>.</p> <p>You either need to install the package or enable it through your <code>php.ini</code> file. </p> <p><strong>php.ini</strong></p> <p>Find this line <code>;extension=php_mbstring.dll</code> and uncomment it by removing the <code>;</code> so it reads <code>extension=php_mbstring.dll</code></p> <p>Or just run <code>php5enmod mbstring</code> if your system allows it</p> <p><strong>Install it</strong></p> <p>In a linux/debian based system it would just be <code>apt-get install libapache2-mod-php5</code>. The package includes the extension as well as everything else you need for Laravel. Considering you have no other errors on install, you likely already have this and just need to enable it in your <code>php.ini</code> file</p>
22,161,980
0
<p>If I understood your question right you can use rgba to shade the color.</p> <ul> <li>background-color: rgba(0, 0, 0, 1.5); // darker</li> <li>background-color: rgba(0, 0, 0, 1.0); // normal</li> <li>background-color: rgba(0, 0, 0, 0.5); // lighter</li> </ul> <p><strong>css</strong></p> <pre><code>.table-class { width: 500px; font-size: 15px; } .table-class td { width: 25%; } #owner tr:nth-child(odd) { background-color: rgba(0, 0, 0, 1.2); color: rgba(255, 255, 255, 0.8); } #owner tr:nth-child(even) { background-color: rgba(0, 0, 0, 0.8); color: rgba(255, 255, 255, 1.2); } </code></pre> <p><strong>html</strong></p> <pre><code>&lt;table class="table-class" id="owner"&gt; &lt;tr&gt; &lt;td&gt;test test&lt;/td&gt; &lt;td&gt;test test&lt;/td&gt; &lt;td&gt;test test&lt;/td&gt; &lt;td&gt;test test&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;test test&lt;/td&gt; &lt;td&gt;test test&lt;/td&gt; &lt;td&gt;test test&lt;/td&gt; &lt;td&gt;test test&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;test test&lt;/td&gt; &lt;td&gt;test test&lt;/td&gt; &lt;td&gt;test test&lt;/td&gt; &lt;td&gt;test test&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;test test&lt;/td&gt; &lt;td&gt;test test&lt;/td&gt; &lt;td&gt;test test&lt;/td&gt; &lt;td&gt;test test&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p><strong>JSFiddle</strong> you can play around with it to see if this is what you need.</p> <p><a href="http://jsfiddle.net/t4J9s/" rel="nofollow">http://jsfiddle.net/t4J9s/</a></p>
10,270,046
0
<p>Change</p> <pre><code>noteIT &lt; trackIT-&gt;getNoteList().end() </code></pre> <p>To</p> <pre><code>noteIT != trackIT-&gt;getNoteList().end() </code></pre> <p>Not all iterators support less than / greater than comparisons.</p> <p>If you have c++11 you can use a range-based for loop:</p> <pre><code>for (Note&amp; note : trackIT-&gt;getNoteList()) </code></pre> <p>Or you can use BOOST_FOREACH</p> <pre><code>BOOST_FOREACH (Note&amp; note, trackIT-&gt;getNoteList()) </code></pre>
18,563,822
0
<p>Your plan sounds good to me except storing keys inside the keystore. Basically, there is only one keystore instance created for all system-level and third-party apps on the device. After Android 4.0, the keystore is integrated with the unlock screen and it is unlocked when the user unlocked the device. So, if you store your key as a key/value pair inside the keystore, then your key is ready before you open your app. Or, if you store it as key/encrypted(value) pair, then you have to derive the key from the password at run-time and decrypt the encrypted value. But you may end up having two password for unlocking the phone screen and unlocking the key. I probably go with with only one password, i.e. screen unlock password. Since the keystore is mapped to the Process ID, it is only accessed from your app. However, if you are thinking to handle multi-user per phone, then the latter approach may be relevant.</p>
25,033,613
0
<pre><code>var printStorageBody = function(){ $("body").html(""); $("&lt;pre&gt;&lt;/pre&gt;").appendTo("body"); $("pre").html("\r\n" + JSON.stringify(localStorage).replace(/","/g , "\r\n").replace("{ ", "").replace(" }","") + "\r\n"); }; </code></pre>
9,834,769
0
<p>new class util.java</p> <pre><code>public class Util { private DataBaseHelper dbHelper; private GeoFencApplicationDataset Dataset; private int getId; public static boolean checkConnection(Context mContext) { NetworkInfo info = ((ConnectivityManager) mContext .getSystemService(Context.CONNECTIVITY_SERVICE)) .getActiveNetworkInfo(); if (info == null || !info.isConnected()) { return false; } if (info.isRoaming()) { return true; } return true; } public void DrawPath(Context c, GeoPoint src, GeoPoint dest, int color, MapView mMapView01) { Dataset = (GeoFencApplicationDataset) c.getApplicationContext(); dbHelper = Dataset.getDbHelper(); StringBuilder urlString = new StringBuilder(); urlString.append("http://maps.google.com/maps?f=d&amp;hl=en"); urlString.append("&amp;saddr=");// from urlString.append(Double.toString((double) src.getLatitudeE6() / 1.0E6)); urlString.append(","); urlString .append(Double.toString((double) src.getLongitudeE6() / 1.0E6)); urlString.append("&amp;daddr=");// to urlString .append(Double.toString((double) dest.getLatitudeE6() / 1.0E6)); urlString.append(","); urlString .append(Double.toString((double) dest.getLongitudeE6() / 1.0E6)); urlString.append("&amp;ie=UTF8&amp;0&amp;om=0&amp;output=kml"); Log.d("xxx", "URL=" + urlString.toString()); Document doc = null; HttpURLConnection urlConnection = null; URL url = null; try { url = new URL(urlString.toString()); urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestMethod("GET"); urlConnection.setDoOutput(true); urlConnection.setDoInput(true); urlConnection.connect(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); doc = db.parse(urlConnection.getInputStream()); if (doc.getElementsByTagName("GeometryCollection").getLength() &gt; 0) { final String path = doc.getElementsByTagName("GeometryCollection") .item(0).getFirstChild().getFirstChild() .getFirstChild().getNodeValue(); final String[] pairs = path.split(" "); String[] lngLat = pairs[0].split(","); final GeoPoint startGP = new GeoPoint( (int) (Double.parseDouble(lngLat[1]) * 1E6), (int) (Double.parseDouble(lngLat[0]) * 1E6)); mMapView01.getOverlays().add( new PathOverLay(startGP, startGP, 1)); GeoPoint gp1; GeoPoint gp2 = startGP; for (int i = 1; i &lt; pairs.length; i++) { lngLat = pairs[i].split(","); gp1 = gp2; gp2 = new GeoPoint( (int) (Double.parseDouble(lngLat[1]) * 1E6), (int) (Double.parseDouble(lngLat[0]) * 1E6)); mMapView01.getOverlays().add( new PathOverLay(gp1, gp2, 2, color)); if (getId != 0) { dbHelper.insertTempLatLong(lngLat[1], lngLat[0], getId); } Log.d("xxx", "pair:" + pairs[i]); } } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } } public double[] getLocation(Context c) { Criteria criteria; String provider; LocationManager locManager = (LocationManager) c .getSystemService(Context.LOCATION_SERVICE); criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setAccuracy(Criteria.ACCURACY_COARSE); provider = locManager.getBestProvider(criteria, true); double[] loca = new double[2]; // For Latitude &amp; Longitude Location location = locManager.getLastKnownLocation(provider); if (location != null) { loca[0] = location.getLatitude(); loca[1] = location.getLongitude(); } else { loca[0] = 0.0; loca[1] = 0.0; } return loca; } public void setId(int id) { // TODO Auto-generated method stub getId = id; } } </code></pre> <p>new class PathOverLay.java</p> <pre><code>public class PathOverLay extends Overlay { private GeoPoint gp1; private GeoPoint gp2; private int mRadius = 6; private int mode = 0; private int defaultColor; private String text = ""; private Bitmap img = null; public PathOverLay(GeoPoint gp1, GeoPoint gp2, int mode) // GeoPoint is a // int. (6E) { this.gp1 = gp1; this.gp2 = gp2; this.mode = mode; defaultColor = 999; // no defaultColor } public PathOverLay(GeoPoint gp1, GeoPoint gp2, int mode, int defaultColor) { this.gp1 = gp1; this.gp2 = gp2; this.mode = mode; this.defaultColor = defaultColor; } public void setText(String t) { this.text = t; } public void setBitmap(Bitmap bitmap) { this.img = bitmap; } public int getMode() { return mode; } @Override public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) { Projection projection = mapView.getProjection(); if (shadow == false) { Paint paint = new Paint(); paint.setAntiAlias(true); Point point = new Point(); projection.toPixels(gp1, point); // mode=1&amp;#65306;start if (mode == 1) { if (defaultColor == 999) paint.setColor(Color.BLUE); else paint.setColor(defaultColor); // RectF oval = new RectF(point.x - mRadius, point.y - mRadius, // point.x + mRadius, point.y + mRadius); RectF oval = new RectF(point.x - mRadius, point.y - mRadius, point.x + mRadius, point.y + mRadius); // start point canvas.drawOval(oval, paint); } // mode=2&amp;#65306;path else if (mode == 2) { if (defaultColor == 999) paint.setColor(Color.RED); else paint.setColor(defaultColor); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setStrokeWidth(5); paint.setAlpha(70); canvas.drawLine(point.x, point.y, point2.x, point2.y, paint); } /* mode=3&amp;#65306;end */ else if (mode == 3) { /* the last path */ if (defaultColor == 999) paint.setColor(Color.GREEN); else paint.setColor(defaultColor); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setStrokeWidth(5); paint.setAlpha(120); canvas.drawLine(point.x, point.y, point2.x, point2.y, paint); RectF oval = new RectF(point2.x - mRadius, point2.y - mRadius, point2.x + mRadius, point2.y + mRadius); /* end point */ paint.setAlpha(120); canvas.drawOval(oval, paint); } } return super.draw(canvas, mapView, shadow, when); } // Read more: // http://csie-tw.blogspot.com/2009/06/android-driving-direction-route-path.html#ixzz1hte9kGoi } </code></pre> <p>final call method ... </p> <pre><code>util = new Util(); mapOverlays = mapView.getOverlays(); util = new Util(); util.setId(id); GeoPoint srcGeoPoint = new GeoPoint((int) (destLat * 1E6), (int) (destLong * 1E6)); GeoPoint destGeoPoint = new GeoPoint((int) (srcLat * 1E6), (int) (srcLong * 1E6)); progrDialog = ProgressDialog.show(AddFenceActivity.this, "", "Please Wait..", true); mapView.getOverlays().add( new PathOverLay(srcGeoPoint,destGeoPoint, 2,Color.RED)); util.DrawPath(AddFenceActivity.this, srcGeoPoint, destGeoPoint, Color.RED, mapView); mapView.getController().animateTo(srcGeoPoint); public class MapOverLayItem extends ItemizedOverlay&lt;OverlayItem&gt; { private ArrayList&lt;OverlayItem&gt; mOverlays = new ArrayList&lt;OverlayItem&gt;(); Context mContext; public MapOverLayItem(Drawable defaultMarker) { super(boundCenterBottom(defaultMarker)); // TODO Auto-generated constructor stub } public void addOverlay(OverlayItem overlay) { mOverlays.add(overlay); populate(); } @Override protected OverlayItem createItem(int i) { // TODO Auto-generated method stub return mOverlays.get(i); } @Override public int size() { // TODO Auto-generated method stub return mOverlays.size(); } public MapOverLayItem(Drawable defaultMarker, Context context) { super(defaultMarker); mContext = context; } } </code></pre>
5,328,972
0
<p>Why don't you add null validation for password before calling ValidateCredentials? On a side note, client side authentication might help as well.</p>
18,354,898
0
CSS Borders workaround <p>On a site I'm building I want to have a 3 coloured border <a href="http://i40.tinypic.com/2mw8lkj.jpg" rel="nofollow">example here</a> for the body. </p> <p>What is the easiest way to create this? </p> <p>I tried the following but it didn't work out how I expected it to: </p> <pre><code>&lt;div id="red"&gt; &lt;div id="white"&gt; &lt;div id="blue"&gt; &lt;!--SITE GOES HERE--&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; #red { width: 100%; height: 100%; padding: 16px; background: #CC092F; } #white { width: 100%; height: 100%; padding: 16px; background: white; position: absolute; z-index: 2; } #blue{ width: 100%; height: 100%; padding: 16px; background: #0C144E; position: absolute; z-index: 3; } </code></pre> <p>The problem with that is the padding pushes the divs offscreen, I realise I'm going about it the wrong way… (If i use percentages i.e. 98% it obviously scales, which I do not want) but I can't think of an alternative. Thanks in advance.</p>
19,113,164
0
<p>I did some research and you can see the implementation I came up with here: <a href="http://jamessdixon.wordpress.com/2013/10/01/handling-images-in-webapi/">http://jamessdixon.wordpress.com/2013/10/01/handling-images-in-webapi/</a></p>
17,108,772
0
<p>I fixed it by doing the following: <em>(this was done using the ADT version of Eclipse, but should be applicable)</em></p> <ul> <li>Project Properties > Java Build Path > Libraries (tab) <ul> <li>Remove each Library</li> <li>Then click Add Library </li> <li>Select the Android Classpath Container</li> <li>Click Next or Finish</li> </ul></li> </ul>
1,017,600
0
<p>the mex endpoint is necessary during development as it provides an http location where the wsdl is built. the wsdl describes to the client how to communicate with the server through named pipes, or TCP/IP, or anything else. once the client app has built the proxy to the named pipes binding and set up the configuration, the mex endpoint is no longer necessary. hence, the mex endpoint can be removed prior to deployment through the environments if desired. </p>
26,455,304
1
Python draw n-pointed star with turtle graphics <p>My professor has asked our class to write a Python function that does as following:</p> <p>Draw a regular n-pointed star with side d - in a function named star(turtle, n, d)</p> <p>Here's the code that I have so far:</p> <pre><code>def star(turtle, n, d): angle = (180-((180*(n-2))/n))*2 for i in range(n): t.forward(d) t.left(angle) return angle </code></pre> <p>The problem that I am experiencing is that my function is only able to draw stars with odd numbers of corners (5, 7, 9-sided stars). When I ask it to draw a star with an even number of sides, it outputs polygon with sides n/2. So asking to draw an 8-sided star outputs a square, 6-sided gives a triangle, and so forth.</p> <p>I've tried altering the angle formula many times, but it never works with any given n.</p> <p>Thanks for helping!</p>
27,690,057
1
How to set all values of a complex dict to the same one? <p>Give a very complex dict <em>dict_a</em>, i.e., some key corresponses to simple value (level-<em>1</em>), but others many corresponse to another dict (level-<em>n</em>).</p> <p>My question is how to set all its values, whether level-<em>1</em> or level-<em>n</em>, to one single value, say 100.</p> <p>For example:</p> <pre><code>a = 10 b = {1: 11, 2: 22, 3{1: 13, 2: {4: 33}}} c = {1: a, 2: b} </code></pre> <p>how to set values of dict c to 0?</p>
35,267,099
0
iOS UITableViewCell autosizing bug <p>I've a <code>UITableViewCell</code> designed with <code>.xib</code> that use cell autosizing. In iOS 9 works well, but in iOS 8 cell doesn't expands itself, and the label inside remains with 1 line of text. If the cell go away from the screen and the came back (i.e. after a scrolling) all label are ok.</p> <p>Ideas? I think this is an iOS 8 bug.</p> <p><a href="https://i.stack.imgur.com/dcG5A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dcG5A.png" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/OTzhA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OTzhA.png" alt="enter image description here"></a></p>
34,307,400
0
PHP Codeigniter site_url produce HTML link error <p>in my view, i try to print URL to my controller, below the code :</p> <pre><code>&lt;p id="demo"&gt; &lt;a href="&lt;?php echo site_url('HT');?&gt;"&gt; Goto Controller &lt;/a&gt; &lt;/p&gt; </code></pre> <p>However those code provide HTML link error like this :</p> <pre><code>&lt;a href="http://::1/cidLab/index.php/HT"&gt; Goto Controller &lt;/a&gt; </code></pre> <p>The link should be go to <strong><code>http://localhost/cidLab/index.php/HT</code></strong> but why must <strong><code>http://::1/</code></strong> ?</p> <p>I've try to use base_url, but still face same Error...</p>
21,136,310
0
How to get the correct information out of a dynamic layer with esri leaflet <p>Ok the problem is, that when i click on the map while having a dynamic layer on top of it the wrong information or no information is getting trough. </p> <p>The example to make it more understandable:</p> <p>The dynamic layer that will be added is:</p> <pre><code> vestigingLayer1 = L.esri.dynamicMapLayer("http://ags101.prvgld.nl/arcgis/rest/services/IBIS_bedrijventerrein_app/IBIS_bedrijventerrein_app/MapServer", { layers: [0], position: 'front', }) map.addLayer(vestigingLayer1); </code></pre> <p>The codepart that reacts on the mouseclick on the layer is:</p> <pre><code>map.on("click", function(e) { if(typeof vestigingLayer1 === 'undefined'){ } else{ vestigingLayer1.identify(e.latlng, function(data) { if(data.results.length &gt; 0) { // Popup toevoegen en informatie toevoegen popupText = "&lt;div style='overflow:scroll; max-width:250px; max-height:260px;'&gt;"; for (prop in data.results[0].attributes) { var val = data.results[0].attributes[prop]; if (val != 'undefined' &amp;&amp; val != "0" &amp;&amp; prop !="OBJECTID" &amp;&amp; prop != "Name") { popupText += "&lt;b&gt;" + prop.replace(" (Esri)",'') + "&lt;/b&gt;: " + val + "&lt;br&gt;"; } } popupText += "&lt;/div&gt;"; //Popup toevoegen op de plaats waar geklikt is. var popup = L.popup() .setLatLng(e.latlng) .setContent(popupText) .openOn(map); } }); } </code></pre> <p>so if you follow the code part via firebug you can see that in data the results always give the information of the same layer(1) or it has no results.</p> <p>Also a link to the working website to make it a bit more clear. <a href="http://geodev.prvgld.nl/geoapp/definitief/kaart.html" rel="nofollow">http://geodev.prvgld.nl/geoapp/definitief/kaart.html</a></p> <p>If someone knows the answer to this i'm really grateful for it.</p>
1,632,832
0
<p>C++ does not have a base object that all objects inherit from, unlike Java. The usual approach for what you want to do would be to use <a href="http://www.parashift.com/c++-faq-lite/templates.html" rel="nofollow noreferrer">templates</a>. All the containers in the standard C++ library use this approach. </p> <p>Unlike Java, C++ does not rely on polymorphism/inheritance to implement generic containers. In Java, all objects inherit from <code>Object</code>, and so any class can be inserted into a container that takes an <code>Object</code>. C++ templates, however, are compile time constructs that instruct the compiler to actually generate a different class for each type you use. So, for example, if you have:</p> <pre><code>template &lt;typename T&gt; class MyContainer { ... }; </code></pre> <p>You can then create a <code>MyContainer</code> that takes <code>std::string</code> objects, and another MyContainer that takes <code>int</code>s. </p> <pre><code>MyContainer&lt;std::string&gt; stringContainer; stringContainer.insert("Blah"); MyContainer&lt;int&gt; intContainer; intContainer.insert(3342); </code></pre>
3,633,671
0
<p>Well you can, although I have to warn you there are several problems with a layout like this. Be sure to understand them before using this. </p> <p>The HTML required is: </p> <pre><code>&lt;div id="container"&gt; &lt;div id="inside"&gt; &lt;div id="offside"&gt; &lt;/div&gt; &lt;div id="center"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>There are two layers of wrappers here. We using the usual <code>margin: 0 auto</code> technique with the outside container to center it, while the inside <code>div</code> gets a negative left margin equal to the width of the off-center <code>div</code>. </p> <pre><code>#container { width: 300px; margin: 0 auto; } #container #inside { margin-left: -100px; overflow: hidden; } #container #inside div { float: left; height: 400px; } #container #inside #offside { width: 100px; background-color: #ddd; } #container #inside #center { width: 300px; background-color: #f9f9f9; } </code></pre> <p>Have a look at it here: <a href="http://www.jsfiddle.net/DfArr/1/" rel="nofollow noreferrer">http://www.jsfiddle.net/DfArr/1/</a></p>
2,853,580
0
<p>Try including slashes on the front:</p> <pre><code>RewriteRule ^/pokerbono/([a-zA-Z0-9_-]+)$ /pokerbono.php?id=$1 [L] </code></pre> <p><strong>UPD</strong>:</p> <p>This works in my environment:</p> <pre><code>RewriteEngine On RewriteRule ^qwe/([-_a-zA-Z0-9]*)$ qwe.php?id=$1 [L] </code></pre>
20,137,682
0
Custom Object empty after creation <p>I have a custom object: <code>Vendor</code> that extends <code>NSObject</code>. I am initiating it like so:</p> <pre><code>NSDictionary *vendorObj = [vendors objectAtIndex:i]; Vendor *vendor = [[Vendor alloc] initWithVendorInfo:vendorObj]; NSLog(@"VendorObj: %@", vendorObj); NSLog(@"Vendor: %@", vendor); </code></pre> <p>Here is what the class looks like:</p> <pre><code>@interface Vendor : NSObject @property (nonatomic, copy) NSString *name; @property (nonatomic, copy) NSString *description; - (id)initWithVendorInfo:(NSDictionary *)vendorDetails; @end @implementation Vendor - (id)initWithVendorInfo:(NSDictionary *)vendorDetails { self = [super init]; if(self) { _name = [vendorDetails[@"company_name"] copy]; _description = [vendorDetails[@"description"] copy]; } return self; } </code></pre> <p>If I NSLog <code>vendorObj</code> all the details are there. Once I initiate the <code>Vendor</code> object and NSLog it, the log shows:</p> <pre><code>2013-11-21 22:22:44.769 [48202:a07] Vendor: </code></pre> <p>I cannot seem to figure out why my object is nothing, no memory address, not even a null. What am I doing wrong here?</p>
10,520,559
0
<p>I would do this in the <code>RowDataBound</code> event. </p> <pre><code>protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { var chk = e.Row.FindControl("CheckBox1") as CheckBox; if (chk != null) { var ddl = e.Row.FindControl("DropDownList1") as DropDownList; if (ddl != null) { //assign the JavaScript function to execute when the checkbox is clicked //pass in the checkbox element and the client id of the select chk.Attributes["onclick"] = string.Format("toggleSelectList(this, '{0}');", ddl.ClientID); } } } </code></pre> <p>The <code>toggleSelectList</code> function would look something like this:</p> <pre><code>toggleSelectList = function(el, selectID){ var selectElement = document.getElementById(selectID); if (selectElement){ selectElement.disabled = !el.checked; } } </code></pre>
7,584,314
0
<p>Hmm, something like this?</p> <pre><code>$("body").click(function(e) { $("treeview").hide(); }); </code></pre>
32,371,116
0
<p>I think its reasonable to say that most algorithms have a best and a worst case. If you think about algorithms in terms of Asymptotic Analysis you can say that a O(n) search algorithm will perform worse than a O(log n) algorithm. However if you provide the O(n) algorithm with data where the search item is early on in the data set and the O(log n) algorithm with data where the search item is in the last node to be found the O(n) will perform faster than the O(log n).</p> <p>However an algorithm that has to examine each of the inputs every time such as an Average algorithm won't have a best/worst as the processing time would be the same no matter the data.</p> <p>If you are unfamiliar with Asymptotic Analysis (AKA big O) I suggest you learn about it to get a better understanding of what you are asking.</p>
39,850,874
0
<p>This is occurred due to HTML Pro module has different methods. That is partially different from DNN HTML Module. below is the code.</p> <pre><code> HtmlTextController htmlTextController = new HtmlTextController(); WorkflowStateController workflowStateController = new WorkflowStateController(); WorkflowStateInfo wsinfo = new WorkflowStateInfo(); int workflowId = wsinfo.WorkflowID; HtmlTextInfo htmlContents = htmlTextController.GetLatestHTMLContent(ModuleModId); HtmlTextInfo htmlContent = new HtmlTextInfo(); htmlContent.ItemID = -1; htmlContent.StateID = workflowStateController.GetFirstWorkflowStateID(workflowId); htmlContent.WorkflowID = workflowId; htmlContent.ModuleID = ModuleId; htmlContent.IsPublished = htmlContents.IsPublished; htmlContent.Approved = htmlContents.Approved; htmlContent.IsActive = htmlContents.IsActive; htmlContent.Content = htmlContents.Content; htmlContent.Summary = htmlContents.Summary; htmlContent.Version = htmlContents.Version; if (Tags != null &amp;&amp; Tags.Count &gt; 0) { foreach (KeyValuePair&lt;string, string&gt; tag in Tags) { if (htmlContent.Content.Contains(tag.Key)) { htmlContent.Content = htmlContent.Content.Replace(tag.Key, tag.Value); } } } htmlTextController.SaveHtmlContent(htmlContent, newModule); </code></pre> <p>And please add below reference to the code to refer the methods.</p> <pre><code>using DotNetNuke.Modules.HtmlPro; using DotNetNuke.Professional.HtmlPro; using DotNetNuke.Professional.HtmlPro.Components; using DotNetNuke.Professional.HtmlPro.Services; </code></pre>
18,679,732
0
<p>If you're using em's then you first need to define a base value for the font. Ex.:</p> <p><code>body { font-size: 16px }</code></p> <p>Now 1em = 16px.</p> <p>Most browsers have a default user-agent font-size of 16px but you shouldn't rely on it. Set the base value then start using em's.</p>
35,413,974
0
<p>I do not know why the accepted answer was selected, it does not remove any warnings when I run this code....</p> <p>I cannot confirm on your specific platform, but adding casts to each string constant has made the warnings go away for me.</p> <pre><code>#include &lt;unistd.h&gt; main() { char* const args[] = {(char*)"/bin/ls", (char*)"-r", (char*)"-t", (char*)"-l", (char*) 0 }; execv("/bin/ls", args); } </code></pre> <p>OR</p> <pre><code>#include &lt;unistd.h&gt; main() { char *args[] = {(char*)"/bin/ls", (char*)"-r", (char*)"-t", (char*)"-l", (char*) 0 }; execv("/bin/ls", args); } </code></pre> <p>It may be overly verbose and annoying, but the warnings go away.</p> <p>I'm running this on: g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4</p>
5,143,719
0
<p>A relative path is specified like this:</p> <pre><code>System.IO.File.ReadAllLines("myfile.txt"); </code></pre> <p>which will search <code>myfile.txt</code> relative to the working directory executing your application. It works also with subfolders:</p> <pre><code>System.IO.File.ReadAllLines(@"sub\myfile.txt"); </code></pre> <p>The <code>MapPath</code> function you are referring to in your question is used in ASP.NET applications and allows you to retrieve the absolute path of a file given it's virtual path. For example:</p> <pre><code>Server.MapPath("~/foo/myfile.txt") </code></pre> <p>and if your site is hosted in <code>c:\wwwroot\mysite</code> it will return <code>c:\wwwroot\mysite\foo\myfile.txt</code>.</p>
26,721,206
0
Mixing HAVING with CASE OR Analytic functions in MySQL (PartitionQualify(? <p>I have a SELECT query that returns some fields like this:</p> <pre><code>Date | Campaign_Name | Type | Count_People Oct | Cats | 1 | 500 Oct | Cats | 2 | 50 Oct | Dogs | 1 | 80 Oct | Dogs | 2 | 50 </code></pre> <p>The query uses aggregation and I only want to include results where when Type = 1 then ensure that the corresponding Count_People is greater than 99.</p> <p>Using the example table, I'd like to have two rows returned: Cats. Where Dogs is type 1 it's excluded because it's below 100, in this case where Dogs = 2 should be excluded also.</p> <p>Put another way, if type = 1 is less than 100 then remove all records of the corresponding campaign name.</p> <p>I started out trying this:</p> <pre><code>HAVING CASE WHEN type = 1 THEN COUNT(DISTINCT Count_People) &gt; 99 END </code></pre> <p>I used Teradata earlier int he year and remember working on a query that used an analytic function "Qualify PartitionBy". I suspect something along those lines is what I need? I need to base the exclusion on aggregation before the query is run?</p> <p>How would I do this in MySQL? Am I making sense?</p>
10,603,346
0
<p>WCF does not directly works on abstract classes. You shall use KnownType attributes on the datacontract or service class. below are examples;</p> <pre><code>[DataContract] [KnownType(typeof(Client))] public class Contact { ... } [ServiceContract] [ServiceKnownType(typeof(Client))] public interface IMyService { contact getcontact(Guid id); } </code></pre>
442,209
0
<p>My guess is that it is a correlation between which tags are most often used together.</p> <p>For example:</p> <ul> <li>Question A tagged with tag1, tag2</li> <li>Question B tagged with tag1, tag3</li> <li>Question C tagged with tag1, tag2</li> </ul> <p>Then it's natural to assume that tag2 "is related to" tag1.</p> <p>I would say the best place to learn would be <a href="http://my.safaribooksonline.com/9780596529321" rel="nofollow noreferrer">O'Reilly's Programming Collective Intelligence book</a>.</p>
37,976,452
0
How can I move the first 2 pdf files in each folder in a directory (and each subdirectory) to a single folder using a batch file? <p>I have a directory that contains several hundred folders, many of which contain other folders, inside of which are anywhere from 6 or 7 to several hundred files of assorted types. I need a batch file that can copy the first 2 PDF files in each folder, including sub-folders, and add them to one, separate folder.</p> <p>I don't think it should make a difference, but not every folder contains 2 or more PDF files. Many contain only other folders, in which case those folders should be searched. Others contain just 1 PDF, in which case it should be added to the separate folder with the others.</p> <p>I have never written/used a batch file and any guidance, explanations or examples would be greatly appreciated.</p>
32,516,637
0
<p>SQLite database file is just a normal file, you do not need any special steps to update it. </p> <p>Get the file path or URL to the SQLite file , and use <code>NSFileManager</code>'s method <code>removeItemAtPath:error:</code> or <code>removeItemAtURL:error:</code></p> <p>Then create the new database the same way you created the old one.</p> <p>Also check this <a href="http://www.musicalgeometry.com/?p=1736" rel="nofollow">link</a> if get any problem.</p> <p><strong>EDIT :</strong> You can delete your old <code>SQlite</code> database file if it's copied in document directory. You CAN NOT delete files from bundle.</p>
3,666,218
0
<p>I think that in general the topics that you have picked are very important, and my give you the chance to do something more than the usual boring stuff. However, I believe that the order should be something like this:</p> <ol> <li>Data structures &amp; Algorithms</li> <li>Functional programming</li> <li>Software Design </li> <li>Specific technologies you need</li> </ol> <p>My opinion is that Algorithms and data structures should be first. It is very hard to study algorithms if you have a lot of other things in you head (good coding practices, lots of programming paradigms, etc.). Also with time, people tend to become more lazy, and lose the patience to get into the ideas of this complex matter. On the other hand, missing some fundamental understanding about how things can be represented or operate, may lead to serious flaws in understanding anything more sophisticated. So, assuming that you have some ideas about imperative programming (the usual stuff tаught in the introductory courses) you should enhance your knowledge with algorithms and data structures.</p> <p>It is important to have at least basic understanding of other paradigms. Functional programming is a good example. You may also consider getting familiar with logic programming. Having basic understanding of Algorithms and Data Structures will help you a lot in understanding how such languages work. I don't know whether Scala is the best language for that purpose, but will probably do. Alternatively, you can pick something more classic like Lisp, or Scheme. Haskell is also an interesting language.</p> <p>About the Design Patterns... knowing design patterns will help you in doing object oriented design, but you should be aware, that design patterns are just a set of solutions to popular problems. Knowing Design Patterns is by no means that same as knowing how to design software. In order to improve you software design skills you should study other materials too. A good example from where you can get understanding about these concepts is the book Code Complete, or the MIT course 6.170 (its materials are publicly available). </p> <p>At some point you will need to get into the details of a specific framework (or frameworks) that you will need for what you do. Keep in mind, that such frameworks change, and you should be able to adapt, and learn new technologies. For instance, knowing ASP.NET MVC now, may be worthless 5 years from now (or may not be, who knows?).</p> <p>Finally, keep in mind, that no matter what you read, you need to practice a lot, which means solving problems, writing code, designing software, etc. Most of these concepts can not be easily explained, or even expressed with words, so you will need to reach most of them by yourself, (that is, you will need to reinvent the wheel many times). </p> <p>Good luck with your career!</p>
14,632,866
0
<p>If you want to use it more times in your program then it's maybe a good idea to make a custom class inherited from StreamReader with the ability to skip lines.</p> <p>Something like this could do:</p> <pre><code>class SkippableStreamReader : StreamReader { public SkippableStreamReader(string path) : base(path) { } public void SkipLines(int linecount) { for (int i = 0; i &lt; linecount; i++) { this.ReadLine(); } } } </code></pre> <p>after this you could use the SkippableStreamReader's function to skip lines. Example:</p> <pre><code>SkippableStreamReader exampleReader = new SkippableStreamReader("file_to_read"); //do stuff //and when needed exampleReader.SkipLines(number_of_lines_to_skip); </code></pre>
891,767
0
How to transpernt white color to background color of image in flex? <p>I have an image and i want to remove white color from image.</p> <p>That removing color is same like its background color. If anybody have any idea of this problem please answer?</p> <p>And my application in Flex 3 so please send me action script code of this problem.Thank you </p>
24,443,008
0
Deleting memory from function C++ <p>I'm having trouble freeing my memory I'm using and a little confused how I would go about doing it. When I do it with the code below i get an error "Heap Corruption Detected... CRT detected that the application wrote to memory after end of heap buffer". I also debugged to make sure there is a memory leak using the Crtdb and there is a leak on that variable. Just am confused how to free it.</p> <pre><code>#include &lt;iostream&gt; #include &lt;string.h&gt; using namespace std; void adjustVar(char*&amp; pointer, size_t i) { pointer = new char[i]; } int main(void) { const char* org = "HELLOWORLD"; char* p = nullptr; size_t size = strlen(org); adjustVar(p, size); memset(p, 0, size+1); strncpy(p, org, size); cout &lt;&lt; p &lt;&lt; endl; delete[] p; return 0; } </code></pre>
6,088,051
0
<p>That loop can't possibly end during your lifetime. <code>10 ** 100</code> is a really really enormous number. It's bigger than the number of particles in the universe, it's bigger than the number of the tiniest time periods that have passed since the creation of the universe. On an impossibly fast computer - <code>3 * 10 ** 46</code> millennia for the loop to complete. To calculate an infinite sum you'd wish to calculate until the sum has stopped changing significantly (e.g. the summands have fallen under certain very small threshold).</p> <p>Also, <code>xrange</code> and <code>range</code> in Python 2 are limited to the platform's long integers, which means that you can't have numbers higher than 2 ** 31 on a 32 bit machine and 2 ** 63 on a 64 bit one, (the latter is still too big to ever complete in your lifetime), this is why you get an <code>OverflowError</code> in Python 2. In Python 3 you'd get no error, but the summation will continue forever.</p> <p>And calculation factorial of such a large number is even slower, so you don't have a chance to ever exceed the maximum even on a 32 bit machine.</p> <p>Search for a function for calculating infinite sums, or do it yourself</p> <pre><code>&gt;&gt;&gt; from __future__ import division &gt;&gt;&gt; import itertools &gt;&gt;&gt; from math import factorial, cos, e &gt;&gt;&gt; for t in [0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1]: ... summables = ((4 ** (2 * n) * cos(2 * n * t)) / (e ** 16 * factorial(n)) ... for n in itertools.count()) ... print 0.5 * (1 + sum(itertools.takewhile(lambda x: abs(x) &gt; 1e-80, summables))) ... 1.0 0.973104754771 0.89599816753 0.77928588758 0.65382602277 0.569532373683 0.529115621076 0.512624956755 0.505673516974 0.502777962546 0.501396442319 </code></pre> <p>Also, I do not recognize the formula, but is this supposed to be <code>(e ** 16) * factorial(n)</code> or <code>e ** (16 * factorial(n))</code>? I just want to point out that you've written the former because of the other answer.</p>
34,582,610
0
Unity Android Get Google Play Advertising ID <p>I'm attempting to get the google play advertising ID in Unity but it doesn't seem to be working at all.</p> <p>Here's the code I'm using that I've found in a couple SO's like <a href="http://stackoverflow.com/questions/28179150/getting-the-google-advertising-id-and-limit-advertising">this one</a>:</p> <pre><code> AndroidJavaClass up = new AndroidJavaClass ("com.unity3d.player.UnityPlayer"); AndroidJavaObject currentActivity = up.GetStatic&lt;AndroidJavaObject&gt; ("currentActivity"); AndroidJavaClass client = new AndroidJavaClass ("com.google.android.gms.ads.identifier.AdvertisingIdClient"); AndroidJavaObject adInfo = client.CallStatic&lt;AndroidJavaObject&gt; ("getAdvertisingIdInfo",currentActivity); advertisingID = adInfo.Call&lt;string&gt; ("getId").ToString(); using(AndroidJavaClass pluginClass = new AndroidJavaClass("example.com.Toast")) { if(pluginClass != null) { toastClass = pluginClass.CallStatic&lt;AndroidJavaObject&gt;("getInstance"); activityContext.Call("runOnUiThread", new AndroidJavaRunnable(() =&gt; { toastClass.Call("toastMessage", advertisingID); })); } } </code></pre> <p>I have to do this on an actual device and haven't found a good way to actually log anything save a Toast message, which doesn't display anything here. But if I do this (which gets the android device ID) the toast displays just fine.</p> <pre><code> AndroidJavaClass up = new AndroidJavaClass ("com.unity3d.player.UnityPlayer"); AndroidJavaObject currentActivity = up.GetStatic&lt;AndroidJavaObject&gt; ("currentActivity"); AndroidJavaObject contentResolver = currentActivity.Call&lt;AndroidJavaObject&gt; ("getContentResolver"); AndroidJavaClass secure = new AndroidJavaClass ("android.provider.Settings$Secure"); string android_id = secure.CallStatic&lt;string&gt; ("getString", contentResolver, "android_id"); </code></pre> <p>Any idea what I should be doing to get the Google Play Advertising ID?</p> <p>I've also tried doing it within the jar code itself natively like this:</p> <pre><code>AsyncTask&lt;Void, Void, String&gt; task = new AsyncTask&lt;Void, Void, String&gt;() { @Override protected String doInBackground(Void... params) { AdvertisingIdClient.Info idInfo = null; try { idInfo = AdvertisingIdClient.getAdvertisingIdInfo(ToastCLass.getInstance().context); } catch (GooglePlayServicesNotAvailableException e) { e.printStackTrace(); } catch (GooglePlayServicesRepairableException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } String advertId = null; try{ advertId = idInfo.getId(); }catch (NullPointerException e){ e.printStackTrace(); } return advertId; } @Override protected void onPostExecute(String advertId) { Toast.makeText(ToastClass.getInstance().context, advertId, Toast.LENGTH_LONG).show(); } }; task.execute(); </code></pre> <p>But that just causes an error on my app when it runs (I think because it's trying to run the AsyncTask on the UI thread?). Again hard, as I haven't really found a way to display the logs/errors.</p> <p>It seems if I run my app on an emulator I can get to a log, which does help with logging out the info.</p>
37,419,607
0
<p>If you set:</p> <pre><code>$this-&gt;table = 'selstock_product'; </code></pre> <p>Prestashop will look for a Key Column named <code>Id_{tablename}</code> , so, you need to rename your PK Field according to the prestashop sintax, That is: <code>Id_selstock_product</code></p> <p>greetings</p>
31,658,826
0
Scraping dynamic web pages using Python 3.4 and beautifulsoup <p>OK, using Python 3.4 and beautifulsoup4 on a windows 7 VM. Having trouble scraping the data resulting from making a selection with a drop-down list. As a learning experience, I'm trying to write a scraper that can select the 4 year option on this page: <a href="http://www.nasdaq.com/symbol/ddd/historical" rel="nofollow">www.nasdaq.com/symbol/ddd/historical</a> and print the rows of the resulting table. So far, it just prints out the default 3 month table, along with some junk at the beginning that I don't want. Eventually I would like to scrape this data and write it to DB using mysql python connector, but for now I would just like to figure out how to make the 4 year selection in the drop down list. (also, would like to get rid of the text encoding that causes it to be in the b'blahblah' format. My code so far:</p> <pre><code>from bs4 import BeautifulSoup import requests url = 'http://www.nasdaq.com/symbol/ddd/historical' with requests.Session() as session: session.headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36'} response = session.get(url) soup = BeautifulSoup(response.content) data = { 'ddlTimeFrame': '4y' } response = session.post(url, data=data) soup = BeautifulSoup(response.content) for mytable in soup.find_all('tbody'): for trs in mytable.find_all('tr'): tds = trs.find_all('td') row = [elem.text.strip().encode('utf-8') for elem in tds] print (row) </code></pre> <p>I get no errors, but it doesn't print out the 4 year data. Thanks for your time/patience/help!</p>
7,417,636
0
<p>Personally I would store them separately as you can handle the data a lot easier. Also, what if the person has a space in their name or accidentally puts it and you want just a first or second name, how ill you determine first or second names if that happens?</p> <p>EDIT:</p> <p>Also, if you want to store more detailed names, I would make a whole range of columns for Prefix, First, Middle, Last and anything you can think of.</p>
30,773,514
0
<p>Create a Map of your words and occurencies. </p> <pre><code>import java.util.*; public class TestDummy { public static void main(String args[]) { String arr[] = { "lady", "bird", "is", "bird", "lady", "cook" }; Map&lt;String, Integer&gt; dictionary = new TreeMap&lt;&gt;(); int len = arr.length; System.out.println("Size " + len); for (int i = 0; i &lt; len; i++) { if (dictionary.containsKey(arr[i])) { dictionary.put(arr[i], dictionary.get(arr[i]) + 1); System.out.format("Duplicate %s%n", arr[i]); } else { dictionary.put(arr[i], 1); } } } } **Output** Size 6 Duplicate bird Duplicate lady </code></pre>
38,639,066
0
Angular textarea validation error <p>I have a textarea in my app like so:</p> <pre><code>&lt;textarea type="text" class="form-control" name="bioBackground" ng-model="obj.background" value="obj.background" ng-change="autosave()" maxlength="1500" required&gt;&lt;/textarea&gt; </code></pre> <p>This is a <strong>required</strong> field and as you can see I have added a required tag in the code. But this required tag is causing errors with Angular.</p> <p>For example:</p> <p>If I type in the field and backspace and remove all the text it removes the object from the scope. see example below:</p> <p><strong>Before Backspacing</strong></p> <p>You can see background variable is in the scope.</p> <p><a href="https://i.stack.imgur.com/wnnHP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wnnHP.png" alt="enter image description here"></a></p> <p><strong>After backspacing and removing the text:</strong></p> <p>You can see the background variable is gone from scope.</p> <p><a href="https://i.stack.imgur.com/Lp1vA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lp1vA.png" alt="enter image description here"></a></p> <p><strong>This only happens if I use required tag. If I don't use the required tag it works fine and even after removing all the text the background variable stays within the scope.</strong></p> <p>What am I doing wrong.</p>
19,538,586
0
<p>Take a look at my implementation of MVVM Navigation via an Interface and it's implementation</p> <p>It's as simple as doing <code>_navigationService.Navigate&lt;Map&gt;(false);</code></p> <p>(I'm navigating to the ViewModel Map, and my NavigationService just knows that X ViewModel is mapped to X.xaml page!) </p> <p>More at <a href="https://github.com/cmorgado/MultiPlatform" rel="nofollow">https://github.com/cmorgado/MultiPlatform</a></p>
2,616,378
0
can't write to physical drive in win 7? <p>I wrote a disk utility that allowed you to erase whole physical drives. it uses the windows file api, calling :</p> <pre><code>destFile = CreateFile("\\\\.\\PhysicalDrive1", GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,createflags, NULL); </code></pre> <p>and then just calling <code>WriteFile</code>, and making sure you write in multiples of sectors, i.e. 512 bytes.</p> <p>this worked fine in the past, on XP, and even on the Win7 RC, all you have to do is make sure you are running it as an administrator. </p> <p>but now I have retail Win7 professional, it doesn't work anymore! the drives still open fine for writing, but calling <code>WriteFile</code> on the successfully opened Drive now fails!</p> <p>does anyone know why this might be? could it have something to do with opening it with shared flags? this is always what I have done before, and its worked. could it be that something is now sharing the drive? blocking the writes? is there some way to properly "unmount" a drive, or at least the partitions on it so that I would have exclusive access to it? </p> <p>some other tools that used to work don't any more either, but some do, like the WD Diagnostic's erase functionality. and after it has erased the drive, my tool then works on it too! leading me to believe there is some "unmount" process I need to be doing to the drive first, to free up permission to write to it. </p> <p>Any ideas?</p> <p>Update:</p> <p>the error code returned from <code>WriteFile</code> is '5', <code>ERROR_ACCESS_DENIED</code> but again, if I 'erase' the drive first using WD Diag, I can then access and write to the drive fine. when I initialize the drive again, and give it a partition, I go back to getting the <code>ERROR_ACCESS_DENIED</code> error.</p>
32,331,515
0
How can I get term aggregation to match a total string? <p>I have a some data that I'm aggregating with elasticsearch 1.5.2 and when I do a terms aggregation on a field like <code>city</code> the buckets don't match full strings from the field. Ex.) If city is St. Louis then one bucket would be <code>St.</code> and the other <code>Louis</code>. Does anyone know how to make sure that when it aggregates it goes into a <code>St. Louis</code> bucket?</p> <p>note: This may be caused from the data being analyzed which I'm pretty sure breaks up strings when comparing and searching etc. </p>
1,502,993
0
<p>I am the one who asks the question. In fact, the tool the closest to my needs seems to be <a href="http://www.lacusveris.com/PythonTidy/" rel="nofollow noreferrer">PythonTidy</a> (it's a Python program of course : Python is best served by himself ;) ).</p>
6,637,497
0
<p>Since <code>Light</code> inherits from <code>Switchable</code>, it could also be deployed with <code>Switchable</code> - it seems, however, due to the naming, that the primary class interacting with the <code>Switchable</code> interface will be <code>Switch</code> - which means that the two are tightly-coupled: you should never put tightly-coupled class/interface definitions in separate assemblies. </p> <p>You could also conceive of other <code>Switchable</code> classes, such as <code>Outlet</code> or a whole set of <code>Appliances</code>. These could be added at a later date, and they would have nothing to do with <code>Light</code>, meaning that <code>Light</code> and <code>Switchable</code> aren't necessarily part of the same component. However, the <code>Switch</code> class would still apply to these new classes and would apply.</p> <p>(It is true that a different consumer of the <code>Switchable</code> interface could be conceived, but it would likely be an awkward adaptation, such as a <code>ToggleButton</code> that toggled the on/off state by remembering the last method called. However, with the names chosen, <code>Switchable</code> still implies that a <code>Switch</code> could be involved.)</p> <p>I hope this answers your question.</p>
7,672,672
0
Issue with QHash <p>I been trying and trying to get this to work but it just refuses to work. I read the QT documentation and I'm just unable to get the insert function to function. When I build I get the following complication errors</p> <pre><code>/home/mmanley/projects/StreamDesk/libstreamdesk/SDDatabase.cpp: In constructor 'SDDatabase::SDDatabase()': /home/mmanley/projects/StreamDesk/libstreamdesk/SDDatabase.cpp:27:44: error: no matching function for call to 'QHash&lt;QString, SDChatEmbed&gt;::insert(const char [9], SDChatEmbed (&amp;)())' /usr/include/qt4/QtCore/qhash.h:751:52: note: candidate is: QHash&lt;Key, T&gt;::iterator QHash&lt;Key, T&gt;::insert(const Key&amp;, const T&amp;) [with Key = QString, T = SDChatEmbed] make[2]: *** [libstreamdesk/CMakeFiles/streamdesk.dir/SDDatabase.cpp.o] Error 1 make[1]: *** [libstreamdesk/CMakeFiles/streamdesk.dir/all] Error 2 </code></pre> <p>here is the header file:</p> <pre><code>class SDStreamEmbed { Q_OBJECT public: SDStreamEmbed(); SDStreamEmbed(const SDStreamEmbed &amp;other); QString FriendlyName() const; SDStreamEmbed &amp;operator=(const SDStreamEmbed &amp;other) {return *this;} bool operator==(const SDStreamEmbed &amp;other) const {return friendlyName == other.friendlyName;} private: QString friendlyName; }; Q_DECLARE_METATYPE(SDStreamEmbed) inline uint qHash(const SDStreamEmbed &amp;key) { return qHash(key.FriendlyName()); } </code></pre> <p>and the implementation</p> <pre><code>SDStreamEmbed::SDStreamEmbed() { } SDStreamEmbed::SDStreamEmbed(const SDStreamEmbed&amp; other) { } QString SDStreamEmbed::FriendlyName() const { return friendlyName; } </code></pre> <p>and how I am invoking it</p> <pre><code>SDChatEmbed embedTest(); ChatEmbeds.insert("DemoTest", embedTest); </code></pre> <p>and the definition of ChatEmbeds</p> <pre><code>QHash&lt;QString, SDStreamEmbed&gt; StreamEmbeds; </code></pre>
32,854,613
0
<p>The password-reset token that Firebase generates when you call <code>resetPassword()</code> expires after 24 hours. That time period is not configurable, nor can the token be extended.</p>
27,406,567
0
<p>You could solve the problem with the help of <a href="http://www.ruby-doc.org/stdlib-1.9.3/libdoc/rexml/rdoc/REXML/Document.html" rel="nofollow"><code>REXML</code></a> library.</p> <pre><code>require 'rexml/document.rb' doc = REXML::Document.new &lt;&lt;-DOC &lt;Reports&gt; &lt;Report active="1" valid="1" bureau="EXS"&gt; Dummy Dummy&lt;/Report&gt; &lt;/Reports&gt; DOC doc.get_text("/Reports/Report") # =&gt; " Dummy Dummy" </code></pre>
22,244,799
0
<p>This is not a bug in Unity.</p> <p>Something inside the OS is getting into a bad state and the touch-drag messages stop flowing smoothly. Sometimes you'll get multiple updates in a frame and sometimes you'll get none.</p> <p>The issue does not happen on iPhone4 or below, or if the game is running at 30Hz frame rate.</p> <p>I experienced this bug while using an in-house engine I'd written while working at a previous company. It first manifest itself after upgrading the UI system of a scrabble genre game, where you drag the tiles about on the screen. This was utterly bizarre, and I was never able to pin down the exact reproduction steps, but they seem to be timing related, somehow.</p> <p>It can also be seen on Angry Birds (unless they've fixed it by now), and a variety of other games on the market, basically anything with touch-drag scrolling or movement. For Angry Birds, just go into a level and start scrolling sideways. Most of the time it'll be silky smooth, but maybe 1 in 10 times, it'll be clunky. Re-start the app and try again.</p> <p>A workaround is to drop the input update frequency to 30Hz for a few frames. This jolts the internals of the OS somehow and gives it time to straighten itself out, so when you crank it back up to 60Hz, it runs smoothly again.</p> <p>Do that whenever you detect that the bad state has been entered.</p>
26,463,738
0
<p>You need to do it in 2 steps.</p> <p>First, you have to parse your CSV. I recommend <a href="http://supercsv.sourceforge.net/examples_reading.html" rel="nofollow">superCSV</a>. Parsing CSV may be fancy sometimes, so I really recommend you to use a library for that.</p> <p>Second, you can serialize into JSON. Then you can use <a href="https://code.google.com/p/google-gson/" rel="nofollow">GSON</a>, <a href="http://jackson.codehaus.org/" rel="nofollow">jackson</a>, <a href="http://flexjson.sourceforge.net/" rel="nofollow">flexjson</a>, whatever.</p>
8,584,034
0
Why are all anonymous classes implicitly final? <p>According to the JLS:</p> <blockquote> <p>15.9.5 Anonymous Class Declarations An anonymous class declaration is automatically derived from a class instance creation expression by the compiler.</p> <p>An anonymous class is never abstract (§8.1.1.1). An anonymous class is always an inner class (§8.1.3); it is never static (§8.1.1, §8.5.2). <strong>An anonymous class is always implicitly final (§8.1.1.2)</strong>.</p> </blockquote> <p>This seems like it was a specific design decision, so chances are it has some history.</p> <p>If I choose to have a class like this:</p> <pre><code>SomeType foo = new SomeType() { @Override void foo() { super.foo(); System.out.println("Hello, world!"); } }; </code></pre> <p>Why am I not allowed to subclass it again if I so choose?</p> <pre><code>SomeType foo = new SomeType() { @Override void foo() { super.foo(); System.out.println("Hello, world!"); } } { @Override void foo() { System.out.println("Hahaha, no super foo for you!"); } }; </code></pre> <p>I'm not saying I necessarily want to, or can even think of a reason why I would. But I am curious why this is the case.</p>
33,366,354
0
How can i get the same functionality as this .each() using a for loop? <p>I have written this function to assign line-height to elements with different heights.Is there any possible way of doing this using a for loop ?</p> <pre><code>$(".portfolio-image-overlay").each(function(){ "use strict"; var height = $(this).siblings("img").height(); var cheight = $(".item.active&gt; a&gt; img").height(); $(this).css({"line-height":height+"px"}); $(this).css({"line-height":cheight+"px"}); }); </code></pre>
1,918,637
0
Django - Designing Model Relationships - Admin interface and Inline <p>I think my understanding of Django's FK and admin is a bit faulty, so I'd value any input on how to model the below case.</p> <p>Firstly, we have generic Address objects. Then, we have User's, who each have a UserProfile. Through this, Users belong to departments, as well as having addresses.</p> <p>Departments themselves can also have multiple addresses, as well as a head of department. So it might be something like (this is something I'm just hacking up now):</p> <pre><code>class Address(models.Model): street_address = models.CharField(max_length=20) etc... class Department(models.Model): name = models.CharField(max_lenght=20) head_of_department = models.OneToOneField(User) address = models.ForeignKey(Address) class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) address = models.ForeignKey(Address) department = models.OneToOneField(Department) </code></pre> <p>Anyhow, firstly, is that the right way of setting up the relationships?</p> <p>And secondly, I'd like it to appear in the admin that you can edit a department, and on that page, it'd have an inline list of all the addresses to also edit. I've tried setting up an AddressInline class, and attaching it as an inline to Department.</p> <pre><code>class AddressInline(admin.TabularInline): model = Address class DepartmentAdmin(admin.ModelAdmin): inlines = [AddressInline] </code></pre> <p>However, when I try to display that, I get:</p> <pre><code>Exception at /admin/people/department/1/ &lt;class 'people.models.Address'&gt; has no ForeignKey to &lt;class 'people.models.Department'&gt; </code></pre> <p>Cheers, Victor</p>
18,392,612
0
<p>Let's say RAND_MAX is 150. (Obviously it's not actually.) And we want numbers from 0-99. Then we do <code>rand() % 100</code>. Cool.</p> <p>The problem is, what if RAND() returns a number greater than 100? Let's take 102. <code>102 % 100 = 2</code>, and <code>2 % 100 = 2</code>. So there is a <code>2/150</code> chance that we will get a 2 with the given algorithm. But a number above 50? There's only a <code>1/150</code> chance that we'll get it. The higher RAND_MAX, the less of a problem this is, but it remains an issue. </p> <p>Notice that if RAND_MAX were divisible by the number that you wanted to "modulate" it by, all numbers would be equally likely. i.e if RAND_MAX were 200 rather than 150. Hope this helps!</p> <p>Edit: the actual math.</p> <p>RAND_MAX is guaranteed to be at least 32767. If we want a range from 0-99, we can do <code>RAND() % 100</code>. Then, numbers between 0 and 67 will all appear 328 possible times, while 68-99 will appear only 327 times each. That's a 1.0010071% chance for the first 68 numbers, and only a 0.9979553% chance for the rest of them. We want them all to be 1%! Usually not a major issue, but depending on the use case, could show some strange behavior.</p>
39,661,549
0
<p><a href="https://ruby-doc.org/core-2.3.0/IO.html#method-c-readlines" rel="nofollow"><code>IO#readlines</code></a> expects a string, not a regular expression. But the desired behaviour might be easily achieved with <code>read</code> + <code>split</code> since according to the documentation <code>readlines</code> “reads the entire file”:</p> <pre><code>f.read.split /\!|\.|\?/ </code></pre> <p>Please also read the valuable comment by @tom-lord with a significant improvement suggestion.</p>
29,754,651
0
How to take date of birth from user and tell its age <p>Hi I want make a console program in c# where the user enters his/her date of birth and the program should return his/her current age...</p> <p>I am a beginner and have really no idea to do that...</p>
23,000,592
0
<p>I have run into similar issues. Most of the times, I fixed it by <strong>casting it to any</strong>. </p> <p>Try this - </p> <pre><code> (&lt;any&gt;grid.dataSource.transport).options.read.url = newDataSource; </code></pre> <p>Or, you can try this too -</p> <pre><code>(&lt;kendo.data.DataSource&gt;.grid.dataSource).transport.options.read.url = newDataSource; </code></pre> <p>But, fist option should work for sure!</p> <p>Hope, this helps</p>
39,998,540
0
<p>You could try one like this</p> <pre><code>&lt;RelativeLayout android:layout_width="200dp" android:layout_height="150dp" android:layout_centerInParent="true"&gt; &lt;RelativeLayout android:layout_width="120dp" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:background="#aaff0000"&gt;&lt;/RelativeLayout&gt; &lt;RelativeLayout android:layout_width="120dp" android:layout_height="match_parent" android:layout_alignParentRight="true" android:background="#aa00ff00"&gt;&lt;/RelativeLayout&gt; &lt;/RelativeLayout&gt; </code></pre>
31,691,685
0
<p>Change this line:</p> <pre><code> this.css("text-shadow", sh); </code></pre> <p>to</p> <pre><code> $(this).css("text-shadow", sh); </code></pre> <p>.css is a jQuery function and it works on a proper selector</p> <p><strong>Demo</strong>: <a href="https://jsfiddle.net/wwqxdjvp/" rel="nofollow">https://jsfiddle.net/wwqxdjvp/</a></p>
26,331,738
0
<p>Ok for anyone else looking for a solution, mine turned to be a combination of looking into how rails's ModelName.exists? works, figuring our how configatron gem works and fixing configatron initializer</p> <p>The bottom line ModelName.exists? wasn't caches and was called 4 times from my code. Fixed to only be called once. </p>
33,097,910
0
<p>This does not seem to be about delphi or blob fields at all, since "the same fingerprint" will rarely (if ever) happen. Even the same person will produce slightly different images every time (s)he puts a finger on the scanner. Therefore the real problem is not checking for equality but checking for close matches which is a nontrivial problem in and of itself. You should consult specialized literature.</p>
30,804,483
0
Batch Getting & Displaying User Input <p>Why is this code not working?</p> <pre><code>@echo off set /p param=Enter Parameters: echo %param% </code></pre> <p>Output:</p> <pre><code>(Nothing) </code></pre> <p>I have searched all relative posts, but I can't find what is wrong with it. There is no space problem, or syntax problem that I can identify</p> <p><strong>Update:</strong> As <strong>rojo</strong> stated, since the code block is working, here is the full code, which is not working.</p> <pre><code>@echo off for /f %%j in ("java.exe") do ( set JAVA_HOME=%%~dp$PATH:j ) if %JAVA_HOME%.==. ( echo java.exe not found ) else ( set /p param=Enter Parameters: echo %param% (statement using JAVA_HOME) ) pause </code></pre> <p>Output:</p> <pre><code>Enter Parameters: jfdklsaj ECHO is off. ... </code></pre>
36,626,426
0
Save recorded sound to project file in UWP <p>I recorded sound with the device's microphone but I don't know how to save it. Is it with the help of <code>MediaCapture</code> element, and if yes, then how to do it?</p>
32,311,645
0
<p>You can pass parameters by using the query string eg.</p> <p><a href="http://www.somesite.com?param1=123&amp;param2=abc" rel="nofollow">http://www.somesite.com?param1=123&amp;param2=abc</a></p> <p>See also <a href="https://en.wikipedia.org/wiki/Query_string" rel="nofollow">Query String</a></p>