input
stringlengths
51
42.3k
output
stringlengths
18
55k
C programming to store 64 bit value in a register by having 8 bit inputs each time <p>I am planning to take 64 bit input basically with 8 bits inputs each time.The problem, i've encountered is that, I've a register of 64 bit where these 8 bits are being written.The 8 bits gets overlapped in 64 bit register each time in...
<p>Since you overwrite <code>input_value</code> in each loop, you'll loose the previous read input.</p> <p>You need to do some shifting and bit-wise or.</p> <p>Assuming the input is MSB first, simply do:</p> <pre><code>// input_value=input; // Replace this line with the two below input_value = input_va...
how to determine the size of internal hard disk attached to PC <p>I am using windows 10 and i want to know the size of hard disk attached to this PC, either from registry keys or in a programming way. Other than internal hard disk size , i also want to know the number of USB ports my system has. Any help in this regar...
<p>Think you're looking for the <a href="https://msdn.microsoft.com/en-us/library/system.io.driveinfo(v=vs.110).aspx" rel="nofollow">DriveInfo</a> class.</p>
How to run progress bar widget from dask.distributed in a separate thread? <p>There is an example <a href="http://distributed.readthedocs.io/en/latest/queues.html" rel="nofollow">here</a>, showing insertion of data for processing in a separate thread. I'm interested in reverse, when data are inserted manually and inter...
<p>This is already the case. When you call </p> <pre><code>client.submit(function, *args, **kwargs) </code></pre> <p>This serializes stuff immediately in the local thread (blocking), but then adds a callback to the Tornado IOLoop (running in a separate thread) to manage the actual communication to the scheduler. Th...
how to put icons for the string array <p>i am currently using an string array in which i have to put icons for the items in navigation drawer.Here is my code</p> <pre><code> &lt;string-array name="drawer_titles"&gt; &lt;item &gt;About Us&lt;/item&gt; &lt;item&gt;FeedBack&lt;/item&gt; &lt;item&gt;Setting&l...
<p>Place your icons in <code>mipmap</code> folder and add their resource id's in <code>string-array</code> as follows</p> <pre><code>&lt;string-array name="icon_array"&gt; &lt;item&gt;@mipmap/ic_about_us&lt;/item&gt; &lt;item&gt;@mipmap/ic_shopping&lt;/item&gt; &lt;item&gt;@mipmap/icon_dining&lt;/item&gt; ...
Silverstripe 3.4 define and public static <p>In Silverstripe 3.4 i get an Error </p> <pre><code>'Parse error: syntax error, unexpected '.', expecting ',' or ';' in /Applications/MAMP/htdocs/Silverstripe/myModule/code/Page.php on line 10' </code></pre> <p>_config.php: </p> <pre><code>define('THIS_MODULE_DIR', basena...
<p>PHP before 5.6 doesn't allow expressions for default values. You could use</p> <pre><code>public static $icon = 'my-folder/img/contact-file.gif'; </code></pre> <p>But that requires the folder to have a specific name.</p> <p>You could also set the value in the same file as class, but after the deceleration</p> <p...
How can you upload files as a stream in go? <p>There are a number of tutorials about posting files using <code>http.Request</code> in go, but almost invariably they start like this:</p> <pre><code>file, err := os.Open(path) if err != nil { return nil, err } fileContents, err := ioutil.ReadAll(file) </code></pre> ...
<p>If you need to set <code>Content-Length</code>, it can be done manually. The following snippet is an example of uploading file and extra parameters as a stream (the code based on <a href="http://depado.markdownblog.com/2016-01-09-buffer-less-multipart-post-in-golang" rel="nofollow">Buffer-less Multipart POST in Gola...
How to compare an array value with another explicit value in python <p>I want to do something like this</p> <pre><code>while(x&lt;100 for x in someList): if someList has a value more than 100 the loop should end. </code></pre>
<p>This will also end the loop when value is greater than 100</p> <pre><code>for x in someList: if x &gt; 100: break </code></pre> <p>You can try this:</p> <pre><code>i=0 while ((i&lt;len(someList)) and (someList[i] &lt;= 100) ): '''Do something''' i+=1 </code></pre>
Add two variable using jquery <p>Hi friends I have two variables price1 &amp; price 2, I am getting price value dynamically using onchange event now i want to add these two variables.</p> <pre><code>//get support layer firmness price $('.support-layer-firmness').on('change', function(e) { //first price var pri...
<p>Make variables as <code>global</code> and set values inside respective change events and then you can add the values anywhere.</p> <pre><code>$(document).ready(function(){ var price1=0; var price2=0; $('.support-layer-firmness').on('change', function(e) { //first price price1 = 300; }); $('.support-l...
how to remove the outside touchable event for popupwindows in android 6.0 <p>Here is my code ,I set outsidetouch listener false ,it is working fine for below 6.0 version mobiles but not for 6.0.</p> <pre><code>LayoutInflater layoutInflater = (LayoutInflater) getBaseContext() ...
<p>Try this:</p> <pre><code>popupWindow2.setTouchable(true); popupWindow2.setFocusable(false); popupWindow2.setOutsideTouchable(false); </code></pre> <p>I have posted the solution <a href="http://stackoverflow.com/a/14602132/2002625">here</a>.</p>
RSpec return 404; Post to subdomain with JSON data <p>I'm trying to send raw JSON within Request Rspec. (Because I tried it in Controller Rspec, but JSON data is not parsed in rails 4.2.) Also I set up the subdomain <strong>api</strong>. </p> <p>I always get <code>404</code>.</p> <pre><code> describe "POST #create" ...
<pre><code>require 'rails_helper' RSpec.describe Api::V1::SubscriptionsController, type: :request do let(:json_body) do '{:foo: 12, bar: 33}' end it "returns not acceptable to non json content-type request" do host! 'api.lvh.me' # &lt;= This is needed because 'api' is the subdomain. headers = { ...
R strsplit function in a data frame <p>I create a data frame which now I want to separate one new column by split the ":" in first column.</p> <pre><code>data frame: unc.edu.0057f9f7-779b-4914-8290-abbad2a0d81e.2556919.rsem.genes.normalized_results:ASL|435 214.4421 unc.edu.0057f9f7-779b-4914-8290-abbad2a0d81e.2556919...
<p>The error is because we have a variable of class <code>factor</code>. Convert it to <code>character</code> and it should work</p> <pre><code>lst &lt;- strsplit(as.character(df$V1), split = ":", fixed = TRUE) </code></pre> <hr> <p>If we need to create two columns, one easy way is with <code>read.table</code></p> ...
Why does angular show page greyed out? <p>I have an angular.js application, where I am trying to redirect usgin the following code:</p> <pre><code>this.openPresentationDetails = function (presentationToShow) { $location.path("/presentation"); }; </code></pre> <p>It redirects to the proper page, however, the page ...
<p>I was invoking openPresentationDetails(...) from a modal form, I had to close the modal first and then redirect.</p>
disable redirect after get_delete_post_link <p>When you click on a link that has the href value of:</p> <pre><code>get_delete_post_link( $id, $deprecated, $force_delete=false ); </code></pre> <p>it deletes the attachment and automatically redirects you to the library. I would like to redirect to the current url inste...
<p>$force_delete == false will trash the post</p> <p>$force_delete == true will delete the post</p> <p>For hook into deleting a post look for this hook: <a href="https://codex.wordpress.org/Plugin_API/Action_Reference/delete_post" rel="nofollow">https://codex.wordpress.org/Plugin_API/Action_Reference/delete_post</a><...
Persistent connections to 100K of devices <p>Server needs to push data to 100K of clients which cannot be connected directly since the machine are inside private network. Currently thinking of using Rabbitmq, Each client subscribed to separate queue, when server has data to be pushed to the client, it publish the data ...
<p>the question is too much generic.</p> <p>I suggest to read this <a href="http://stackoverflow.com/questions/22989833/rabbitmq-how-many-queues-rabbitmq-can-handle-on-a-single-server">RabbitMQ - How many queues RabbitMQ can handle on a single server?</a> </p> <p>Then you should consider to use a <a href="http://www....
The sum of the digits of a number without arrays <p>given <code>var num = 123456</code> how can I find the sum of its digits (which is 21 in this case) without using arrays?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var num = 123456, sum = 0; while ( num &gt; 0 ) { sum += (num % 10)|0; num /= 10; } document.write(sum);</code></pre> </div> <...
Java: Can the mocked code be placed in test folder? <p>For the Java projects, we have the best practice of segregating functional code in to "main" folder and unit test code in to "test" folder.</p> <p>As part of testing, we also create mock provider objects, typically where integration/external calls are involved. My...
<p>Yes, you are absolutely right. These "stub" objects (as opposed to mocks) should be placed in the test source root.</p> <p>There is a case where you would place them in a main folder and that is if you want to share the stubs across multiple modules. If you need to do this, then the stubs should be moved to the mai...
Does it make sense to put my website (inetpub) files on a shared drive? <p>I have a hosting setup running in azure with a load balancer and VM's running IIS, my application uses data like pictures etc, which are stored on a network share, so all VM replications can access it. I was just thinking that each VM has IIS co...
<p>Interesting idea - not sure what the performance would be like. A more conventional approach would be to use Cloud Services, or (newer/better) use VM Scale Sets. Create a base image with IIS on it, and package your application code in a VM Extension. That way, when Azure autoscales your VMSS, it will deploy your ...
How to run django server with ACTIVATED virtualenv using batch file (.bat) <p>I found this post to be useful on <a href="http://stackoverflow.com/questions/3027160/how-to-code-a-batch-file-to-automate-django-web-server-start">how to code a batch file to automate django web server start</a>.</p> <p>But the problem is, ...
<p>try <code>\path\to\env\Scripts\activate</code></p> <p>and look at <a href="https://virtualenv.pypa.io/en/stable/userguide/#activate-script" rel="nofollow">virtualenv docs</a></p>
ImageResize on Android <p>I am trying to work on a small requirement which provides users with an option to resize an image to a given percentage. Lets say 75% is the option. Does that mean I should <strong>resize</strong> the image size to 75% or the <strong>resolution</strong> of the image to 75%? </p> <p>Any though...
<p>I think </p> <p>image resolution is 100% like 100x100 or 200x200 or 1000x1000</p> <p>user want to resize it to 75%</p> <p>I think scaleX, scaleY</p> <p>so on the end image must be 75% like 75x75 or 150x150 or 750x750</p>
Plural or singular namespace names in C++ <p>Suppose we have a namespace containing several policy classes:</p> <pre><code>namespace loggingPolicy { class OnWrite {...}; class OnReadWrite {...}; etc. } // namespace </code></pre> <p>The name <code>LoggingPolicy::OnWrite</code> makes sense. On the other han...
<p>There is no technical argument for or against any of this choice. Basically it's a packaging choice, like a library name or a header name. </p> <p>There are some consistency arguments in favor of the singular if you place yourself on the side of your users:</p> <ul> <li>the user will use your LoggingPolicy framewo...
Choose a random number from a list of integer <p>I have a list of integers <code>intList = {1, 3. 5. 2}</code> (Its just an example integer and size both are unknown). I have to chose a random number from that list.</p> <pre><code>RandomInt = rand() % intList.size() </code></pre> <p><em>will work in a similar way as...
<p>Since, as a substep, you need to generate random numbers, you might as well do it the C++11 way (instead of using modulo, which incidentally, is <a href="http://stackoverflow.com/questions/5008804/generating-random-integer-from-a-range">known to have a slight bias toward low numbers</a>):</p> <p>Say you start with<...
How to fix VectorDrawableCompat configuration error in Android Studio? <p>I created a project in Android studio. <strong>Even without modifying any single character in the project I cannot run it.</strong> It gives following error.</p> <blockquote> <p>java.lang.RuntimeException: Unable to start activity ComponentI...
<p>Seems this is an issue with incompatible gradle version reported here.. <a href="https://code.google.com/p/android/issues/detail?id=214182" rel="nofollow">Google issue</a></p> <p>Updatating gradle version may fix this - </p> <pre><code>buildscript { ... dependencies { classpath 'com.android.tools.build:gra...
NameError: name 'addition' is not defined <p>I am getting <code>NameError: name 'addition' is not defined</code> while running following code</p> <pre><code>class Arithmetic: def __init__(self, a, b): self.a = a self.b = b def addition(self): c = a + b print"%d" %c def sub...
<p>If you want to use your 'addition' method, you first need to instantiate an Arithmetic() object and use dot notation to call their functions. Make sure you properly indent your code because not only is it breaking a lot of PEP 8 rules but it just looks plain messy. In your first definition, don't forget you have to ...
How to change multiple icon marker from direction in google maps <p>Sory for my english, i want to create route direction with multiple marker in google maps, i try from this tutorial <a href="http://stackoverflow.com/questions/36523773/how-to-make-route-direction-between-multiple-markers">Direction with multipe marker...
<p>You are missing <code>map: map</code> part when creating markers:</p> <pre><code>for (i = 0; i &lt; locations.length; i++) { marker = new google.maps.Marker({ position: new google.maps.LatLng(locations[i][1], locations[i][2]), icon:'http://s7.postimg.org/wg6bu3jpj/pointer.png', map: map })...
Uncaught TypeError: $(...).datepicker error on datepicker <p>So I want to have a text field where a calendar pops up and a user can easily pick a date. However, I am getting <code>Uncaught TypeError: $(...).datepicker is not a function</code> error when I try to debug why the calendar is not popping out. </p> <p>Below...
<p>You included three different copies of jQuery.js, including one <em>after</em> the jQuery-ui.js include so when you use <code>$</code> you'll be getting the third instance with no jQuery-UI.</p> <p>Your code works if you remove the second and third of those includes, as you can see if you expand and run this snippe...
Scala Byte type can contain -128 but not 128 <p>I'm new to Scala. I've encountered a strange fact that it's <code>Byte</code> type can contain -128 but not 128.</p> <pre><code>scala&gt; val overflow1NegByte = -129:Byte &lt;console&gt;:11: error: type mismatch; found : Int(-129) required: Byte val overflow1N...
<p>Because that's <a href="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html" rel="nofollow">the range of a <code>Byte</code> on the JVM</a>:</p> <blockquote> <p><code>byte</code>: The byte data type is an 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum va...
How to insert new value into array as per key value using Javascript <p>I need one help. I need to insert one new value into existing array by matching the key value using Javascript.I am explaining the scenario below.</p> <pre><code>var galArr=[ {'image':'12.png','comment':'hii','act':'edit'}, {'image':'13....
<p>This should be sufficient. </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var galArr=[ {'image':'12.png','comment':'hii','act':'edit'}, {'image':'13.png','c...
Umbraco Change Type of Multiple Media Picker To List<Image> <p>I add to my umbraco DataType a Multiple Data Pickers (One Of an Archetype )</p> <p>I Want in my model change the type from the string with comma to <code>List&lt;Image&gt;</code></p> <p>I found this code :</p> <pre><code>var list= item.HasValue("media") ...
<p>OfType does a type check and filters the list. If <code>item.GetValue("images")</code> does indeed give you an enumerable of IPublishedContent you would want to call: <code>Select(_ =&gt; new Image(_))</code> instead.</p> <p>If however item.GetValue("images") just gives you the comma delimited string you'd need t...
Error at the time of reading elements from Excel in POI <p>I have written the below piece of code to read elements from Excel. however at the time of running this code getting the error. Can anyone help me with this?</p> <pre><code>package testUtilities; import java.io.File; import java.io.InputStream; import java.io...
<p>You're most likely missing a required jar-file. Using maven? Add this:</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;org.apache.xmlbeans&lt;/groupId&gt; &lt;artifactId&gt;xmlbeans&lt;/artifactId&gt; &lt;version&gt;2.6.0&lt;/version&gt; &lt;/dependency&gt; </code></pre> <p>to your pom.xml.</p>
Java- Print the source code of imported class <p>Is there any way to view the source code of the imported class? For example</p> <pre><code>import java.io.Reader; public class Helper { public static void main(String args[]){ // print source code of java.io.Reader } } </code></pre> <p>How can I print t...
<p>Why do you want to print the source code of imported class.</p> <p>Yes you can view the source code of imported class. In your case source code for <code>Reader</code> can be found in <code>C:\Program Files\Java\jdk1.8.0_101\src.zip\java\io\Reader.java</code> or the path where JDK is installed in your system.</p> ...
ExpandableListView - How can i print empty message if no childs present? <p>I am developing an app which has an ExpandableListActivity. When a group has no children, I would like it to show a message that shows no children's are present.</p>
<pre><code> expandableListView.setOnGroupClickListener(new OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { if(adapter.getChildrenCount(groupPosition)==0) { //show message return t...
How to know if value is in arraylist or not? <pre><code>ArrayList&lt;History1&gt; hist; //i have an class History1 hist= new ArrayList&lt;&gt;(); public class History{ x=text.gettext; y=text1.gettext; public History(){ for(History hiss: hist){ if(hiss.getint()==x &amp;&amp; hiss.getint2()==y){ System.out.pri...
<p>This is probably what you want:</p> <pre><code>if (hist.contains(x) || hist.contains(y) ) { System.out.println("Contained in the ArrayList."); } else { System.out.println("Not contained in the ArrayList."); } </code></pre> <p>Be careful about the types of x and y, they should match the type of elements yo...
How to read a list of values from column in a datatable which has a data from a xml file to a combo box in datagrid? <p>I have the following xml file</p> <pre><code>&lt;WG&gt; &lt;WGT&gt; &lt;TName&gt;tanme1&lt;/TName&gt; &lt;Fname&gt;fname1&lt;/Fname&gt; &lt;Product&gt;Product1&lt;/Product&gt; &lt;Produc...
<p>Create a DataGridTemplateColumn:</p> <pre><code> &lt;DataGridTemplateColumn Header="Product" Width="Auto" MinWidth="120"&gt; &lt;DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate DataType="YourModel"&gt; &lt;ComboBox Items...
Track location of iphone and notify if crosses certain kilometeres in ios Objective C <p>I want to track the location of my ios device and notify in the app if it crosses certain kilometres.Suppose I want to notify if it crosses 1 km from current location of device. Please help I am new in iOS programming.</p> <p>I am...
<p><code>self.currentLocation</code> must be an object of <code>CLLocation</code>.</p> <pre><code>- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation { CLLocationDistance dist = [self.currentLocation distanceFromLocation:userLocation.location]; if (dist == 1000.0) { ...
HttpURLConnection Throwing OutOfMemoryError <p>I am making a network call as instructed in developer.android.com (by using <code>HttpURLConnection</code>). Now I am getting a out of memory exception and app is getting crashed.</p> <p>The following is the stack trace:</p> <pre><code>E/AndroidRuntime: FATAL EXCEPTION: ...
<p>Try this <code>readIt</code> method,</p> <pre><code>public String readIt(InputStream stream) throws IOException, UnsupportedEncodingException { StringBuffer sb = new StringBuffer(); BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8")); String line; while ((lin...
Java stream - Get objects of consecutive same field <p>I don't know how to describe the goal I want to achieve with a good title. I have a list of objects where each have a boolean member. I want to filter this list to get at the end the first objects from the list which all have this boolean member set to true.</p> <...
<p>Maybe something like this would work: </p> <pre><code>ArrayList&lt;YourClass&gt; newList = new ArrayList&lt;&gt;( list.stream() .filter(obj -&gt; obj.isMemberTrue()) .collect(Collectors.toList()) ); </code></pre> <p>remember to import java.util.stream.Collectors if you want to return it as a list.</p>
Reaching the result then returns to the initial state <p>So I'm in the process of learning prolog.</p> <p>All I want to do is to change the order of elements and get the new list as result.</p> <p>When tracing the solution I get to the right answer, however once I reach the base case Prolog starts to empty the list a...
<p>If understood correctly what you're trying to do you could write:</p> <pre><code> accRev([],[]). accRev([X|Y], Lout):- split_list([X|Y],Z1), split_list(Y,Z2), accRev(Z2,Z3), append(Z1,Z3,Lout). split_list([],[]). split_list([X|[]], [X]). split_list([X,_|T], [X|R]):-split_list(T,R). </code></pre...
Is there a way to use JMS in a JUnit test? <p>I want to run a JUnit test with usage of JMS. Is it possible to have a JUnit test use JMS outside of an Application Server like JBoss or a CDI container? </p>
<p>Provided that sending and consuming the message is completely decoupled from JMS, you could mock it. </p> <p>For example: You can have a class that implements an interface like "IMyClassSender". In real code (non junit), all this class does is submit the message to JMS. In junit, implement IMyClassSender with a c...
How can I get the source of an iframe that only works on specified domains? <p>So I'm trying to read the source of an url, let's say domain.xyz. No problem, I can simply get it work using HttpWebRequest.</p> <pre><code>HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlAddress); HttpWebResponse response = (...
<p>That's likely the <code>referer</code> property of the web request: typically a browser tells the web server where it found the link to the page it is requesting.</p> <p>That means, when you create the web request for the iframe, you set the referer property of that request to the page containing the link.</p> <p>...
How to find date among different strings and convert it to correct date format? <p>I have one problem, </p> <p>I am using angularjs for the front end, so I have date picker in the directive.</p> <pre><code>&lt;input " + required + " id='" + elementName + "' name='" + elementName + "' ng-model='question.answer.Selec...
<p>"Z" is kind of a unique case for DateTimes. The literal "Z" is actually part of the ISO 8601 datetime standard for UTC times. When "Z" (Zulu) is added on the end of a time, it indicates that that time is UTC, so really the literal Z is part of the time. This probably creates a few problems for the date format librar...
I am getting this expection "java.lang.NumberFormatException.forInputString(Unknown Source)" while connecting Hbase using spark scala <p>I am reading Hbase table using spark scala.</p> <p>code is follows:</p> <pre><code>package HBase import org.apache.hadoop.hbase.client.{HBaseAdmin, Result} import org.apache.hadoop...
<p>Try setting the port number in the <code>hbase.master</code> config.</p> <pre><code>conf.set("hbase.master", "10.163.12.87:60000") </code></pre>
How to validate total sum through jquery? <p>I have this field where the total amount is written and another field below the total amount field which can be appended multiple times by jQuery and the total amount written in field below can't exceed the amount in the total amount field. Is there any way to calculate this...
<p>I think this is what you need.On submit call this function</p> <pre><code> function calculateSum(){ var sum =0; $( ".txt-schedule-amount" ).each(function() { sum = sum + parseInt($(this).val()); }); $("#total_cost").val(sum); } </code></pre>
Is it possible to apply analyzers in DB index <p>In elastic-search, we can apply analyzers for indexing.</p> <p>And I need to know in DB can we apply analyzers or any other technique while indexing</p>
<p>SQL Server was probably the first database to offer analyzers with v7, back in 1997. The feature was called <code>Query Analyzer</code> in the past, now it's <a href="https://msdn.microsoft.com/en-us/library/hh231122.aspx" rel="nofollow">Database Tuning Advisor</a>. It was also one of the first if no the first to co...
Removing elements from arbitary columns in a Matrix in MATLAB <p>Suppose I have a matrix in MATLAB.</p> <pre><code>&gt;&gt; m = [1 2 3; 4 5 6; 7 8 9] m = 1 2 3 4 5 6 7 8 9 </code></pre> <p>I have a list of indices, and I would like elements at those indices to be removed from ...
<p>As you need the elements shifted up, the solution is a two-step one. First transpose the matrix, remove the corresponding elements, and then reshape and transpose the result. (If shifting up were allowed, then you wouldn't need to transpose). Assuming the indices are stored in a matrix, <code>remove</code>, then:...
Get values into a map using spring el <p>I have a value in a properties file that goes</p> <pre><code>currency.codes=US:USD,IN:INR,AU:AUD </code></pre> <p>I am looking to get these values into a map with a (key,value) pair like (US,USD) etc using spring el I'm trying something like </p> <pre><code>@Value("#{'${curre...
<p>You can write a static helper method and <a href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/expressions.html#expressions-types" rel="nofollow">use that in your expression</a> to reduce the complexity of the SpEL code.</p> <pre><code>public class MapDecoder { public static Map&lt;...
Calendar Day Render event <p><img src="http://i.stack.imgur.com/NBnqv.png" alt=""></p> <p>I have created a booking app which shows the available and not available date by C# asp.net, when i debug the app locally it works fine, but when i upload it on the remote server it gives HTTP Error 404.0 - Not Found, recently i ...
<p>The DayRender event requires the event-handler to be mapped. You haven't shown that in your code. You'll need to add this during your Page_Init event (not the Page constructor):</p> <p>public override void OnInit(Object sender, EventArgs e) { this.Calendar1.DayRender += new EventHandler( Calendar1_DayRender ); }</p...
What is the correct Tag usage in ASP.net Core? TagHelpers vs HTML Helper <p>Since the release of ASP.Net Core, Asp team is pushing the use of TagHelpers more than the HTML helpers.</p> <p>While scaffolding view from controller, ASP.Net Core creates add, edit page with the use of TagHelpers, But it you see the index pa...
<p>According to that thread, </p> <p><a href="https://github.com/aspnet/Mvc/issues/3003" rel="nofollow">https://github.com/aspnet/Mvc/issues/3003</a></p> <p>it seems like for the moment DisplayNameFor is here to stay and that there is no Tag Helper for your solution.</p> <p>They mention <code>&lt;label asp-for="blab...
Magento 2.1.1 Admin content pages not loading handle not registered <p>In my Magento 2.1.1 shop with 2 custom modules some of my admin content pages are not loading. (Widget, theme and shedule are loading fine - others not :-( )</p> <p>For all of these I get "Not registered handle" error: Not registered handle cms_pag...
<p>Thanks - changing permissions didn't help.</p> <p>But found the problem and solution: I had the di.xml splitted over etc/di.xml and etc/adminhtml/di.xml ==> this is wrong and causes failure. No merged back into 1 di.xml and errors are solved.</p> <p>:-)</p>
Excel adding more conditions in a formula <p>I believed the condtions written will be quite long and i am not really good in writing this long formula There are 6 columns i've used which is D ,E, M, N, O, P<br> Sample data: </p> <pre><code>D3=123456(Changing variable as it can be 12345, 12345A,123456A) E3=1 M3=3...
<p>As I couldn't quite catch all the conditions and outcomes, here is an example of how your formula could look:</p> <pre><code> =IF(LEN(D3)=5,Outcome_1_Concatenation,IF(LEN(D3)=7,Outcome_2_Concatenation,IF(ISNUMBER(VALUE(RIGHT(D3,1))),Outcome_3_Concatenation,Outcome_4_Concatenation))) Outcome_1_Concatenation =&gt...
Sending mail with Office365 & MicrosoftGraph fails with "Forbidden" <p>I downloaded the Office 365 Connect ASP.NET MVC sample code from <a href="http://dev.office.com/code-samples-detail/5985" rel="nofollow">http://dev.office.com/code-samples-detail/5985</a>, registered it as an application in Azure Active Directory (I...
<p>I suspect you've set up Send Mail as an Application Permission (authenticates as the app using client credentials - typically as more of a background process) instead of Delegated Permission (authenticate as a particular user).</p>
Error in webdriver.Chrome() After updated my Ubuntu from 14.04 to 16.04 <p>I have recently updated my Ubuntu from 14.04 to 16.04 when I am trying to run the driver = webdriver.Chrome() </p> <pre><code>I am using the Python Selenium and getting the following error: File "/usr/local/lib/python2.7/dist-packages/selenium...
<p>That's an old version of chromedriver, first things first, download the latest chromedriver, add it to the system path.</p>
Getting error in pom.xml. It shows connection timed out. My network proxy does not allow to connect to Maven <p>When I was trying to use Maven in my project, I got the below error building:</p> <blockquote> <p>CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.5.1 ...
<p>Your connection has timed out - make sure that you are connected to the internet (e.g. try <code>ping repo.maven.apache.org</code> from your command line). If you are behind a proxy server you'll have to add configuration accordingly (<a href="https://maven.apache.org/guides/mini/guide-proxies.html" rel="nofollow">h...
SimpleJDBCCall handle out paramater with resultset <p>I am using spring jdbc. I want result set with out param. separately i done but together i am not able to do.</p> <pre><code> CREATE DEFINER=`xxx`@`%` PROCEDURE `client_xxxx`( IN p_xxxx TINYINT(1) UNSIGNED, IN p_result SMALLINT(2) UNSIGNED, OUT p_res...
<p>I find it in simple way that i miss.</p> <pre><code>public Map&lt;String, Object&gt; xxx(String sp, Object... paramsArray) { SimpleJdbcCall jdbcCall = new SimpleJdbcCall(dataSource).withProcedureName(sp); return jdbcCall.execute(paramsArray); } </code></pre> <p><code>execute()</code> gives two parameters ...
How can I make the WebView in JavaFx wait an arbitrary amount of time without hanging the app? <p>Can someone please explain to me what I am doing wrong with the below code?</p> <p>I am using the executeJavascript method to send a series of commands to the Webview, I want to loop through each command and then wait an ...
<p>Try to extend your ScriptRunner class in Thread</p> <pre><code>public class ScriptRunner extends Thread { @Override public void run() { printOut("Running Test"); try (InputStream fileInputStream = new FileInputStream("test.txt"); InputStreamReader inputStrea...
Liferay error org.hibernate.MappingException: Unknown entity: com.mycompany.myapp.model.MyModel <p>I am using Liferay 6.2 GA5 Community Edition.</p> <p>I created entities normally in my <code>service.xml</code>, run a Service Builder, and successfully generated all classes files. I tried any CRUD operation in MyModel...
<p>Are you mixing ServiceBuilder-generated entities with raw hibernate access? I'd rather suggest that you either stay on the ServiceBuilder side (which mostly hides hibernate from you) or you go hibernate all the way and omit ServiceBuilder. </p> <p>Within the context of Liferay (e.g. the need to cover applications d...
Implementing UPPER,TRIM and REPLACE in Apache Pig <p>I am quiet new to pig environment. I have tried to implement my pig script file in two ways.</p> <p>I.</p> <pre><code>data = LOAD 'sample2.txt' USING PigStorage(',') as(campaign_id:chararray,date:chararray,time:chararray,display_site:chararray,placement:chararray,w...
<p>While you are applying <code>TRIM</code> in <code>val1</code> there is nothing called "<code>keyword</code>" in <code>val</code>.</p> <p>Note when you are applying any Function <strong>use alias</strong> so that error u can avoid..</p> <p>or before creating a new relation it is always good to use <strong><code>des...
Comma seperated against unique value via vba <p><a href="http://i.stack.imgur.com/phErT.png" rel="nofollow">enter image description here</a>How u are doing well, i want to required data by vba programing. can you guys help me.</p> <p>below is raw data.</p> <p>USERID QTY Loc 14405 18 India 34479 18 UK 38155 1...
<p>Here you go, something that will start you with some standard excel functionality.</p> <ol> <li>Paste your data in a single cell, and split using Text to columns on DATA tab:</li> </ol> <p><a href="http://i.stack.imgur.com/lOPPM.png" rel="nofollow"><img src="http://i.stack.imgur.com/lOPPM.png" alt="First"></a></p>...
Replace div on hover (div rollover) <p>I have two div with different data. I want to replace div with other on hover. </p> <p>I can do this in CSS but my data have images and links. so i use image in css i can not put</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">...
<p>No example given so i'm assuming.</p> <p>HTML</p> <pre><code>&lt;div id="div1"&gt;Some data&lt;/div&gt; &lt;div id="div2" style="display:none;"&gt;Some other data&lt;/div&gt; </code></pre> <p>Javascript (with jQuery)</p> <pre><code>$("#div1").on('mouseover', function() { $("#div2").show(); $(this).hide()...
Call to a member function isAdmin() on null in laravel <p>i want to basic authenticate <strong>if User is Admin then Request next</strong> otherwise redirect to homepage</p> <blockquote> <p><strong>User.php</strong></p> </blockquote> <pre><code>&lt;?php namespace App; use Illuminate\Foundation\Auth\User as Authen...
<p>First of all, if I were you, I would try to understand what is happening under the hood because it is a bizarre to receive true from <code>Auth::check()</code> and null from <code>Auth::user()</code>. Have you changed the Guard?</p> <p>I am asking this because check() works like that:</p> <pre><code>/** * Determi...
pass R complex object to armadillo C++ <p>R uses, when interfacing with other languages, the header <code>R_ext/Complex.h</code> which includes the type <code>Rcomplex</code> which seems to be an implementation of <code>std::complex&lt;double&gt;</code>. The standard way of using it would be for a complex vector <code>...
<p>Complex numbers are less common in statistics so that has not been an initial focus. However there are use cases Baptiste has <a href="https://cran.r-project.org/package=planar" rel="nofollow">one</a> or <a href="https://cran.r-project.org/package=cda" rel="nofollow">two</a> packages which pushes to add features to ...
How can I auto capitalize the first word of a sentence using Ckeditor? <p>While typing inside CKEditor/Textbox automatically Every first letter of sentence should be in upper case. In multiline text box its working well. But CKeditor its not working. The code I have tried is below.</p> <pre class="lang-js prettyprint...
<p>You can do this with css also</p> <pre><code>p.caps:first-letter{ text-transform: capitalize } </code></pre> <p>here is <a href="https://jsfiddle.net/z3empmvv/" rel="nofollow">fiddle</a></p>
PHP map() equivalent to parse $_POST vars to associative array <p>I need to parse $_POST form vars that were created dynamically using jQuery. The vars have a common structure which is text_id. For example:</p> <pre><code>$_POST[ 'my_app_custom_size_23' ] = large $_POST[ 'my_app_custom_color_23' ] = red $_P...
<p>A trivial <a href="http://regular-expressions.info" rel="nofollow">regex</a> <a href="https://regex101.com/r/IlCzmz/1" rel="nofollow">solution</a> (though this regex is <a href="https://regex101.com/r/IlCzmz/1/debugger" rel="nofollow">quite expensive</a>):</p> <pre><code>foreach ($_POST as $key =&gt; $value) { ...
HSQLDB 2.3.3: How to create type java list? <p>Can we create <strong>custom type</strong> which is of type <code>java.util.List</code>?</p> <pre><code>CREATE TYPE list EXTERNAL NAME 'java.util.List' LANGUAGE JAVA; </code></pre>
<p>Types can be created based on an existing supported type, so this cannot be used for your purpose.</p> <p>The SQL equivalent of a list is an ARRAY. You should use an array such as INTEGER ARRAY, or VARCHAR(100) ARRAY. The Java form of the array to use in the Java static method is Object[].</p>
TFS Build Agent Pool: Error Connecting The Server <h2>TFS Build Agent Pool Setup Error:</h2> <ul> <li>I am trying to setup an agent pool on a server on a domain to connect to the TFS which in another domain, </li> </ul> <h1>Expected:</h1> <p>A prompt appear to enter the Authentication for the user name &amp; Passwo...
<p>I just tested on my side to deploy a build agent cross domain. After enter the TFS domain username and password, I got a TF14045 error.</p> <p><a href="http://i.stack.imgur.com/FfGEC.png" rel="nofollow"><img src="http://i.stack.imgur.com/FfGEC.png" alt="enter image description here"></a></p> <p><a href="http://i.s...
Summing the values of one element of a dictionary based upon the values of another element <p>Using Python, I have a list of two-element dictionaries which I would like to sum all the values of one element based upon the values of another element. ie.</p> <pre><code>[{'elev': 0.0, 'area': 3.52355755017894}, {'elev': 0...
<p>this is very easily achieved using pandas. Sample code:</p> <pre><code>import pandas as pd df = pd.DataFrame([{'elev': 0.0, 'area': 3.52355755017894}, {'elev': 0.0, 'area': 3.5235575501288667}]) </code></pre> <p>which gives the following dataframe:</p> <pre><code> area elev 0 3.523558 0.0 1 3.523558 ...
Java getDeclaredMethod() parameterTypes for string parameter <p>I have a simple question. I want to get <code>String.TYPE</code> as <code>parameterType</code> in <code>getDeclaredMethod()</code> but I can not find it.There is for example <code>Long.TYPE</code> for Long data type but there is not any thing similar for S...
<p><code>Long.TYPE</code> is for the primitive type <code>long</code>. </p> <p>There is no such thing for reference types such as String.</p> <p>You want <code>String.class</code>. (<code>Long.class</code> would be for the boxed type <code>Long</code>).</p>
Increment Value in directive <p>I have a directive which is inside ng-repeat. For example:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="nx-owl-col" nx-...
<p>It can be managed by many ways, some of them:</p> <ol> <li>two way binding but complex variable like object - <code>{ count:1 }</code></li> <li>service with variable and using it in controller and directive</li> <li>usage of local variable in directive</li> <li>remove isolated scope and increment complex scope vari...
Reloading a datatable without refreshing with ajax <p>I have a datatable in a tab that is loaded from data sended by the controller on index method.</p> <pre><code>$data = array( 'documents' =&gt; $this-&gt;getDocuments(), //more stuff... ); $this-&gt;load-&gt;view($this-&gt;config-&gt;item('groupViews'...
<pre><code> var table=$('#tableid'); $('#tableid').on('click','thedeletebuton_id',function(event) { event.preventDefault(); var id=$(this).data('id'); // pass the id to the controller to delete using ajax $.ajax({ type: "POST", url: "&lt;?php echo base_url('your controller'...
Why the user account status is not changed <p>A user account 'john' use a default profile,<code>FAILED_LOGIN_ATTEMPTS</code> is set to 10.Password has been entered incorrectly 11 consecutive times and prompt </p> <blockquote> <p>'ORA-28000,the account is locked'.</p> </blockquote> <p>On Database Control,the user ac...
<p>I realize that i made a mistake. </p> <p>In order to test that letters composed of username are case sensitive,i had created a username <code>'john'</code>,and another username was specified with double quotes which is <code>"john"</code>.</p> <p>The letters are case sensitive but will be automatically converted ...
Select the value in the matrix/ array/ list <p>I was a beginner in python programming. What is the difference:</p> <pre><code>a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] </code></pre> <p>with</p> <pre><code>a = [0 1 2 3 4 5 6 7 8 9] </code></pre> <p>I have</p> <pre><code>a = [0 1 2 3 4 5 6 7 8 9] </code></pre> <p>I want t...
<pre><code>a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] </code></pre> <p>is a valid list,</p> <pre><code>a = [0 1 2 3 4 5 6 7 8 9] </code></pre> <p>is not a valid list</p> <p>Assuming you want to turn:</p> <pre><code>a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] </code></pre> <p>into </p> <pre><code>a = [0, 1, 2, 3, 4, 5, 6] </code>...
How to save special array data into Three MySQL table in PHP <p>I have JSON which need to insert into MySQL table. </p> <p>What I already did is, convert it to array using:</p> <pre><code>$json_data = json_decode($geo_json, true); </code></pre> <p>and get an output of array but I do not know how to inset into second...
<p>$json_data["features"][$array_index]["geometry"]["type"]</p> <p>For table2:</p> <pre><code>foreach($json_data["features"] as $info){ $type = $info["geometry"]["type"]; $latlng_0 = $info["geometry"]["coordinates"][0]; $latlng_1 = $info["geometry"]["coordinates"][1]; // DO INSRET with $type, $latlin...
How to find out which MOC concerned by NSManagedObjectContextObjectsDidChange <p>How can I recognize which MOC did change when receiving a <code>NSManagedObjectContextObjectsDidChange</code> notification. Apparently <code>userInfo</code> employs a key <code>"managedObjectContext"</code>, but I have not found this one d...
<p>It's in the <code>object</code> property of the <code>NSNotification</code>.</p> <pre><code>- (void)contextDidChange:(NSNotification *)notification { NSManagedObjectContext *context = notification.object; } </code></pre>
How can I get the single latest value from an infinite RxJs stream that is not the initial value? <h3>The concept</h3> <p>This is a mocked angular2 project.</p> <p>When consuming the observable stream from the redux store I tried to filter first and then take/takeLast/last the latest value. After that I want to reso...
<p>This should simulate your situation.</p> <p>See live demo: <a href="https://jsfiddle.net/usualcarrot/zh07hfrc/1/" rel="nofollow">https://jsfiddle.net/usualcarrot/zh07hfrc/1/</a></p> <pre><code>var subject = new Rx.Subject(); subject.skip(1).last().subscribe(function(val) { console.log('next:', val); }, function...
How to make Media Foundation H.264 decoder work? <p>For some reason I'm not able to decode H.264. The input/output configuration went well, just like input/output buffer creation.</p> <p>I'm manually feeding the decoder with the H.264 demuxed from a live stream. Therefore, I use MFVideoFormat_H264_ES as media subtype....
<p>When creating input buffer, GetInputStreamInfo() returns 4096 as buffer size, which is too small. Setting input buffer to 4MB solved the problem. The buffer can probably be smaller... still have to test that.</p>
How to get non-overlapping dates? <p>I would like to know how can I vectorize this code.</p> <pre><code>dates = list(as.Date(c("2000-02-08", "2000-02-11")), as.Date(c("2000-03-02", "2000-03-07")), as.Date(c("2000-03-02", "2000-03-07")), as.Date(c("2000-03-03", "2000-03-07")), as.Date(c("2000-03-16"...
<p>With <code>foverlaps</code> from package <code>data.table</code>:</p> <pre><code>dates = list(as.Date(c("2000-02-08", "2000-02-11")), as.Date(c("2000-03-02", "2000-03-07")), as.Date(c("2000-03-02", "2000-03-05")), as.Date(c("2000-03-09", "2000-03-15")), as.Date(c("200...
Invisible unicode characters loaded to DB in python <p>There are many questions and fixes for this but none seems to work for me. My problem is I am reading a file with strings and loading each line into DB.</p> <p>In file it is looking like normal text,while in DB it is read as a unicode space. I tried replacing it w...
<p>Try this:</p> <p>This will remove <code>Unicode</code> character</p> <pre><code>&gt;&gt;&gt; s = "The abrupt departure" &gt;&gt;&gt; s = s.decode('unicode_escape').encode('ascii','ignore') &gt;&gt;&gt; s 'The abrupt departure' </code></pre> <p>Or, You can try with replace as you have tried. But you forget to re...
How not to escape an ampersand with python subprocess <p>I'd like to execute with <code>subprocess.Popen()</code> this command containing an ampersand to be interpreted as a batch concatenation operator:</p> <pre><code>COMMAND="c:\p\a.exe &amp; python run.py" subprocess.Popen(COMMAND,cwd=wd,shell=False)` </code></pre>...
<p>I would use <code>Solution 3</code></p> <pre><code>The &amp; character is used to separate multiple commands on one command line. Cmd.exe runs the first command, and then the second command. </code></pre> <p>In this case you could just write your batch file like this:</p> <pre><code>@echo off c:\p\a.exe python r...
How to access deep nested NSDictionary in Swift 3? previously we used to access like this - <pre><code>aryTblContentfromHome[0]["movieList"]!![0]["likesPer"]!!["text"] as?String aryComments[0]["userName"]!!["text"] as?String </code></pre>
<p>Consider unwrapping it step by step. Doing that you can also make sure that your app does not crash because of force unwrapping if in any case the data is not in the format that you want it to be in. Consider the following code, I tried to safely unwrap depending on your given code.</p> <pre><code>if let dictionary...
Getting error back after executing a shell script via Golang <p>I have a simple shell script (named <code>copy.sh</code>) which looks like below:-</p> <pre><code>#! /bin/sh cp $1 $2 </code></pre> <p>I did <code>chmod 777 copy.sh</code>.</p> <p>I have a golang code which executes the above shell code:-</p> <pre><co...
<p>Alrighty! So the problem at its core is that you have two different places that you can get an error:</p> <ol> <li>When exec.Command().Output() can't run your shell script at all (because it doesn't have permissions in this case), and</li> <li>When your shell script itself runs, but returns an error code (because ...
Using Firebird 2.5.6 in Visual Studio 2015 Community <p>I require some assistance in getting Visual Studio 2015 Community connected to firebird.</p> <p>I am new to Visual Studio 2015 (used to program in Delphi/C++ builder), and I am now learning C# and want to use a firebird database.</p> <p>Could anyone please assis...
<p>I figured it out.</p> <p>Perform the following steps:</p> <p>Install Firebird 2.5.6.</p> <p>Following packages needed:</p> <ol> <li>EntityFramework (v6.1.3 at time of writing)</li> <li>FirebirdSql.Data.FirebirdClient (v5.1.1 at time of writing)</li> <li>EntityFramework.Firebird (v5.1.1 at time of writing)</li> <...
Java Bytecode Bad Instruction <p>I am currently writing a bytecode compiler for my own DSL. However, when executing the bytecode, which I constructed with ASM, I get the following error:</p> <pre><code>Exception in thread "main" java.lang.VerifyError: Bad instruction Exception Details: Location: ForClass.doLoop(...
<p>The solution is simple, I used a wrong method:</p> <p>Instead of using <code>visitVarInsn(SIPUSH, 1000)</code>, use <code>visitIntInsn(SIPUSH, 1000)</code>.</p>
Linear Programming with Anaconda <p>I have installed Anaconda on my windows 10 and I am using it for Python. I have a class in Mathematical optimization and need a good package for basic LP. <strong>Is there a "pre-installed" package that is good for LP in Anaconda, that I can just import to my python file, or do I hav...
<p>If you wish to install PuLP on top of Anaconda on Windows it looks like you need to run:</p> <blockquote> <p>pip install pulp</p> </blockquote> <p>See pulp <a href="https://pythonhosted.org/PuLP/main/installing_pulp_at_home.html" rel="nofollow">docs</a></p>
how to get two divs side by side like whatsappweb from two different pages? <p>Anyone can help me how to get two divs side by side like whatsapp web from different pages using javascript.I want to show them in a single page.Below is my code:</p> <p>code of page1.html:</p> <pre><code>&lt;div class="page1"&gt; &lt;p&gt...
<p>Is this what youre looking for ?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>section { width: 100%; height: 200px; margin: auto; } div#page1{ ...
Dynamic SQL in WHERE clause <pre><code>SELECT A.COL1, A.COL2, A.COL3, A.COL4 FROM TABLE A, TABLE B WHERE B.COL1 = A.COL1 AND B.COL2 = A.COL2 AND B.COL3 - A.COL3 AND B.COL4 = A.COL4 </code></pre> <p>Now I want to tune the SQL query, that whenever any of the Columns in Table B has field value 'ALL' the where clause will...
<p>Use OR wisely:</p> <pre><code>SELECT A.COL1, A.COL2, A.COL3, A.COL4 FROM TABLE A, TABLE B WHERE (B.COL1 = A.COL1 OR B.COL1='ALL') AND (B.COL2 = A.COL2 OR B.COL2='ALL') ... </code></pre> <p>I would also suggest learning JOIN syntax.</p>
canvas draw not smooth circles <p>At the first of my game, I draw some circles from alpha 0 to 255 using canvas(it's like making a fade_in animation by myself)</p> <p>But if you see in picture(this picture captured in alpha 230),from alpha 0 to 254 these circles aren't smooth!(click on picture to see what I mean)</p> ...
<p>Set the following property to paint object</p> <pre><code>paint.setAntiAlias(true); </code></pre> <p>For better understanding and other approaches refer this link <a href="https://medium.com/@ali.muzaffar/android-why-your-canvas-shapes-arent-smooth-aa2a3f450eb5#.p9iktozdi" rel="nofollow">https://medium.com/@ali.m...
Presentation of data in a SSRS chart <p>Maybe it's strange because I found nothing in the same kind but.. I'm working on SSRS and I have a chart with many categories (A, B, C, ...) on axis X. I would like to add, on the same axis, a category which is the sum of categories B,C,D for exemple. Is it possible ? If yes, pl...
<p>I'd calculate the total from MDX query instead of SSRS. Using something like this:</p> <pre><code>WITH MEMBER [Measures].[Gender] AS [Customer].[Gender].currentmember.PROPERTIES("NAME") SELECT { [Measures].[Internet Sales Count], [Measures].[Gender] } ON COLUMNS, nonempty({ [Custome...
Why we use return in the end of function while not returning any value <p>I am confused about return statement , why we need to use return in end of function , for example</p> <pre><code> function test($a){blah; blahh ; blahhh; blahhhhh; retur...
<p>It depends on what you're trying to achieve.</p> <blockquote> <p>If you write <code>echo</code> in several places, your code will get confusing. In general, a function that returns a value is also more versatile, since the caller can decide whether to further manipulate that value or immediately print it.</p> </b...
Filter by attribute value in Orion Context Broker does not work <p>I do not understand why but for some cases filter does not work. Below is my example:</p> <blockquote> <p>/v2/entities?type=carparks&amp;q=name==Parking+Tina+Balice+Krakow&amp;options=keyValues</p> </blockquote> <p>returns:</p> <pre><code>[ { ...
<p>Whitespaces in URL query needs to be correctly encoded, either with <code>+</code> or <code>%20</code>. Have a look <a href="http://www.w3schools.com/tags/ref_urlencode.asp" rel="nofollow">to this document</a>.</p> <p>Thus, try the this way</p> <pre><code>/v2/entities?type=carparks&amp;q=name==Parking+Tina+Balice+...
"sslv3 alert handshake failure" on ruby 2 <p>I am trying to use a webservice with ruby, but it seems to be an issue with it's SSL configuration and ruby 2:</p> <pre><code>&gt;&gt; require "open-uri" =&gt; true &gt;&gt; open("https://w390w.gipuzkoa.net/WAS/HACI/HFAServiciosProveedoresWEB/services/FacturaSSPPWebServiceP...
<p>The server supports only very few ciphers, most of the completely insecure (export ciphers, DES-CBC-SHA) and the only at least a bit secure cipher (DES-CBC3-SHA) is considered insecure since <a href="https://sweet32.info/" rel="nofollow">Sweet32</a>. Chances are high that because of this insecurity modern TLS stacks...
Google Script - convert sheet to XLSX <p>I have this code that search new doc in drive folder, and send files via email</p> <pre><code>var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getActiveSheet(); var email = "xxx@gmail.com"; var timezone = ss.getSpreadsheetTimeZone(); var today = new D...
<p>You can follow this <a href="https://ctrlq.org/code/20124-convert-google-spreadsheet-to-excel" rel="nofollow">tutorial</a> on how to convert the current Google Spreadsheet to Excel XLSX format and then emails the file as an attachment to the specified user using <code>getGoogleSpreadsheetAsExcel()</code> method.</p>...
android get context of fragment in activity <p>I want to get the context or instance of fragment in a activity.I tried following code: In fragment:</p> <pre><code>public static XXFragment instance; </code></pre> <p>In the onCreate():</p> <pre><code>instance = this; </code></pre> <p>In activity:</p> <pre><code>Co...
<p>I think there is some error in your way of thinking about <code>Context</code> :-)</p> <p>First of all, <code>Fragment</code> does not have a <code>Context</code> until added to an <code>Activity</code>. After it is added, the <code>Activity</code> itself is it's Context, so there is no need to extract it from the ...
Why have this warning with YACC? <p>I have a project in my university to make a mini shell with the C language. For parse the command line I use the tools: lex and yacc. When compiling with YACC I get these warnings, but I do not understand why. </p> <p>The file parser.yacc: </p> <pre><code>%{ #include &lt;stdio.h&g...
<p>I have changed my parser.y file to, it's ok: </p> <pre><code> %{ #include &lt;stdio.h&gt; void yyerror(char *s); extern int yylex(); %} %token NEWLINE PIPE AND OR AMPERSAND BLANK WORD IDENTIFIER GREAT GREAT_GREAT LESS ERR_GREAT ERR_GREAT_GREAT GREAT_AMP GREAT_GREAT_AMP SEMICOLON %start cmd_lists %% cmd_lists: ...
Angularjs directive append $http request <p>I want to create an angularjs directive that appends new directive after ajax call.</p> <pre><code>var app = angular.module("app",[]); // This directive is simple search operation. app.directive("search", function("$http", function($http){ return { restrict: "E...
<pre><code> controller: function($scope){ $scope.search = function(){ $http({url: "..."}) .then(function(response){ $scope.searchResult = response.data; }); } }, link: function(scope,element){ $scope.$watch('searchResult'...
How delete the JSESSIONID cookie from the browser with HttpOnly flag set <p>Apologies if I sound bad.</p> <p>I have a <code>xyz.war</code> that does some authentication and sets a cookie(with <code>HttpOnly</code> set so I can not expire it via javascript) so that when the user logs-in for the next time the session is...
<p>You would have invalidate the session in xyz application. Removing (thus beeing able to midify) cookie by third parties would be a security hole.</p>
Changing a cell value in a xlsl sheet while keeping the format nodejs <p>Title is what I'm trying to achieve. Basically I want to edit a existing excel sheet that is formatted with fonts/styles etc and keep those fonts/styles intact while changing a particular cells value.</p> <p>I've tried using the xlsx npm module, ...
<p>In <a href="https://www.npmjs.com/package/xlsx" rel="nofollow">documentation</a> it says: <em>The raw data is the only thing guaranteed to be saved. Formulae, formatting, and other niceties may not be serialized (pending CSF standardization)</em> under <strong>writing options</strong> section.</p>
Build GBM classification model with customer post-stratification weights <p>I am attempting to produce a classification model based on the work of qualitative survey data. About 10K of our customers were researched and as a result a segmentation model was built and subsequently each customer categorised into 1 of 8 cus...
<p>You can use case weights with <code>gbm</code> and <code>train</code>. In general, the list of models in <code>caret</code> that can use case weights is <a href="http://topepo.github.io/caret/train-models-by-tag.html#Accepts_Case_Weights" rel="nofollow">here</a>.</p>
Object not found!-Error 404-codeigniter-xampp server <p>Pages.php in controller folder</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php defined('BASEPATH') OR e...
<p>Check that you have set your base url in config.php</p> <pre><code>/* |-------------------------------------------------------------------------- | Base Site URL |-------------------------------------------------------------------------- | | URL to your CodeIgniter root. Typically this will be your base URL, | WITH...
bootstrap datepicker default view date <p>I want to use the datepicker with a specific default date, but somehow this doesn't work:</p> <pre><code>&lt;input class="cal-datepicker" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" data-date-today-highlight="true" data-date-default-view-...
<p>As <a href="http://stackoverflow.com/a/31202155/6105873">this answer</a> says, you have to use the setDate function of the datepicker library. Like this:</p> <pre><code>$('#datepicker').datepicker('setDate', new Date()); // = set to today </code></pre>
Concourse time resource not triggered on Mac OS X <p>I'm new to concourse and really excited to start working with it but I have a problem running the hello world example described here: <a href="https://concourse.ci/hello-world.html" rel="nofollow">https://concourse.ci/hello-world.html</a> (example with time resource)...
<p>Sounds like you are running your worker on OS X. All the built-in resources require at least 1 worker in your pool that support the linux platform. This would account for the time resource never firing.</p>
Adding an extension in Sphinx (Python Documentation Generator) configuration file <p>I want to use Sphinx as a documentation generator. When I try to run the <strong>make html</strong> command, I have the following error : </p> <p><code>Extension error: Could not import extension sphinxcontrib.httpdomain (exception: N...
<p>The configuration is in the <code>source</code> folder of your Sphinx project. It is named <code>conf.py</code> and contains an <code>extensions</code> option which should look like this:</p> <pre><code># Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sph...