input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Java: implementation of Gaussian Blur <p>I need to implement Gaussian Blur in Java for 3x3, 5x5 and 7x7 matrix. Can you correct me if I'm wrong:</p>
<ol>
<li><p>I've a matrix(M) 3x3 (middle value is M(0, 0)): </p>
<pre><code>1 2 1
2 4 2
1 2 1
</code></pre></li>
<li><p>I take one pixel(P) from image and for eac... | <p>First of all, your formula for calculating the index in the source array is wrong. The image data is stored in the array one pixel row after the other. Therefore the index given <code>x</code> and <code>y</code> is calculated like this:</p>
<pre><code>index = x + y * width
</code></pre>
<p>Furthermore the color ch... |
Hibernate Mapping using xml without creating table from hibernate framework <p>I am a totally beginner student in hibernate. I read tutorials available in various websites but actually I can't understand hibernate mapping using XML without creating table from hibernate framework. </p>
<p>Can anybody help me in hiberna... | <p>I used this website to go through the tutorial. It helped a lot for clearing up my basic hibernate questions.
<a href="http://www.mkyong.com/tutorials/hibernate-tutorials/" rel="nofollow">http://www.mkyong.com/tutorials/hibernate-tutorials/</a></p>
|
angular 2 load unload css , script files of component specific <p>I am at the beginner stage in angular 2 .
In my angular 2 Single page application i have no. of script and css files to be load in one of my component.</p>
<p>Now when i open that component view in browser , it loads all files at head of html page and w... | <p>Use lazy loading to load the feature modules as required.</p>
<p><a href="https://angular.io/docs/ts/latest/guide/ngmodule.html#!#lazy-load" rel="nofollow">https://angular.io/docs/ts/latest/guide/ngmodule.html#!#lazy-load</a></p>
|
Hazelcast & OSGI: ClassNotFoundException <p>I have a OSGI (Equinox-based) platform running a bundle. This bundle connects to Hazelcast for retrieving some data with:</p>
<pre><code>ClientConfig clientConfig = new XmlClientConfigBuilder(configIs).build();
clientConfig.setClassLoader(com.MyClass.class.getClassLoader());... | <p>I solved my issue. If one day someone faces the very same one, please not that Predicate are managed on server side. It means you must import the bean class in the Hazelcast classpath.</p>
|
JavaScript is appending to a Div tag but with some strange behaviour <p>I have a script that for every click of the button takes the time, applies @gmail.com to the end and appends it to a defined div tag.</p>
<p>where the problem lies is that every time i hit the button, the first line changes to the current time, an... | <p>You are calling <code>Time()</code> onclick in your HTML. You do not need to say <code>$("button").click</code> again in your jquery.</p>
<p>Also, you do not need <code>document.getElementById("demo").innerHTML</code> when assiging the string to <code>var j</code>.</p>
<p>See the following code:</p>
<p><div clas... |
List all my beans loaded by SpringApplication.run <p>I am trying to enlist all the beans written by me when I boot up the SpringApplication. </p>
<p>Getting <em>all</em> the beans listed is done. This code does it. </p>
<pre><code>String[] beanNames = appContext.getBeanDefinitionNames();
Arrays.sort(beanNames);
for ... | <p>Using <code>ConfigurableApplicationContext</code> you can get all bean types. For example:</p>
<pre><code>@Autowired
ConfigurableApplicationContext context;
.....
ConfigurableListableBeanFactory beansFactory = context.getBeanFactory();
String[] beansNames = beansFactory.getBeanDefinitionNames();
Set<String> ... |
Java check String input <p>I am trying to check an input String:
- length
- type
- special char at the end</p>
<p>The input is a identity card like this 24659213Q.</p>
<p>So what I got for now is:</p>
<pre><code> public void datosUsuario() {
System.out.print("Write ID: ");
input = scanner.nextLine();
}
... | <p>I'd use a regular expression:</p>
<pre><code>String input = scanner.nextLine();
input.matches("/^[0-9]{8}[A-Za-z]$/);
</code></pre>
<p>See <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#matches(java.lang.String)" rel="nofollow"><code>String.matches</code></a> and <a href="https://docs.ora... |
How to Divide screen into 4 equal part using Grid layout in android? <p>I have try to divide the screen into 4 equal parts but got problem.</p>
<pre><code> <GridLayout
android:rowCount="2"
android:columnCount="2"
android:layout_width="match_parent"
android:layout_height="match_parent"&... | <p>You can do it with LinearLayout.Below is a example of 4 buttons.</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<L... |
Error: Please provide a path to the Android SDK <p>After installing the Android studio and launching it I am getting this error.
<a href="http://i.stack.imgur.com/jFxtJ.png" rel="nofollow"><img src="http://i.stack.imgur.com/jFxtJ.png" alt="enter image description here"></a></p>
<p>I cannot specify the path to the SDK.... | <p>Try this - <code>C:\Users\Your Name\AppData\Local\Android\Sdk</code></p>
<p>Replace <code>Your Name</code> with the name of your PC. </p>
|
file_get_contents() [function.file-get-contents]: Filename cannot be empty <p>How to fix this warning?</p>
<blockquote>
<p>Warning: file_get_contents() [function.file-get-contents]: Filename cannot be empty in C:\xampp\htdocs\blob\index.php on line 26</p>
<p>Unknown column 'value' in 'field list'</p>
</blockquo... | <p>you use this code :</p>
<pre><code>$image= file_get_contents($images);
</code></pre>
<p>but your variable is $image not $images, maybe you can try this :</p>
<pre><code>$image= file_get_contents($image);
</code></pre>
|
how to provide grant to specific user role automatically for frequently drop and create table <p>I Have 2 schema in my database. One of the schema has a package which is using a another schema's table. The Table from another schema, which is frequently drop and create with same name after a time span.</p>
<p>So, when ... | <p>Unfortunately there isn't any automatic task to do this. you should write code to automate this. please check <a href="http://psoug.org/reference/ddl_trigger.html" rel="nofollow">http://psoug.org/reference/ddl_trigger.html</a>. it will help you.</p>
|
c# Canvas Zoom Functionality issue ?Not able to zoom out to original postion after zooming in to a point using matrix transform <p>I'm trying to implement a canvas zoom functionality in c# using matrix transform. I'm able to zoom in to one particular point, but while zooming out to the original scale(i've limited to or... | <p>Not sure if I understand what you're exactly trying to achieve. Also, having the Canvas in a ScrollViewer might mess things up.</p>
<p>But probably this MouseWheel handler does what you want:</p>
<pre><code>private double scale = 1;
private void Canvas_MouseWheel(object sender, MouseWheelEventArgs e)
{
var el... |
Why do I get UNMET PEER DEPENDENCY when I install karma and gulp-karma? <p>Following <a href="https://www.supnig.com/blog/get-your-metal-tested-test-angularjs-and-typescript-with-karma-and-jasmine" rel="nofollow">this</a> tutorial I would like to use karma for testing. When I install karma and gulp-karma I get the erro... | <p>The root of the problem is that gulp-karma package is <a href="https://www.npmjs.com/package/gulp-karma" rel="nofollow">deprecated</a> now.</p>
|
Symfony2: How do I use in a form (query builder) left join and isnull? <p>I have a problem with a filter function for which I am using two tables.
The first âeventcheckin-tableâ is used for checking in the guests via booking-ID for a certain event. Therfore it should also verify if the ID is already checked in. Th... | <p>As i think, you can use <a href="http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/query-builder.html" rel="nofollow">andWhere</a> statement like :</p>
<pre><code>$er->createQueryBuilder('b')
->leftjoin('AppBundle:EventCheckin', 'e', 'with', 'e.bookingBooking = b.Id')
->andWh... |
Swift Buttonaction Text Change <p>Trying to make the text change when its pressed and shows different type of map (Hybrid, standard or satellite).
But when i press the button i get error (well, not when i don't have the "textchange" code in it). So how do i make the text change when it knows its different type of map w... | <p>I would rather use <code>UISegmentedControl</code> when switching between three states.</p>
<p>Create an <code>IBAction</code> with CTRL dragged connection from your Storyboard's UISegmentedControl element.</p>
<p>Implement the method as following:</p>
<pre><code>@IBAction func segmentedControlChanged(_ sender: U... |
Loading a 3d model from DB and using it in Three.js <p>now my task is to load a 3d model from a MySQL database and use it in Three.js.</p>
<p>Here is what I have done,</p>
<p>i created a database like this</p>
<pre><code>models{model_id int(4), model mediumblob};
</code></pre>
<p>I can successfully load the 3d mode... | <p>Looking at <a href="http://stackoverflow.com/questions/13225726/i-need-my-php-page-to-show-my-blob-image-from-mysql-database">I need my PHP page to show my BLOB image from mysql database</a> I would try taking the
:
<code><img src="image.php?id=<?php echo $image_id; ?>" /></code> line and using the <co... |
How to use instagram api when i don't have my own website <p>I can't understand how i can use instagram API.
When i registered my app in <a href="https://www.instagram.com/developer" rel="nofollow">instagram.com/developer</a> i need to put my website and redirect url. But i don't have any website and where i can take r... | <p>Try to enter in the redirect URL something in the following format:</p>
<p><a href="http://somesite://?token=123abct&registered=1" rel="nofollow">http://somesite://?token=123abct&registered=1</a></p>
<p>You don't need your own site. Check out also this:</p>
<p><a href="http://iosdevelopertips.com/cocoa/la... |
How to insulate a character vector after a dataframe is created in R? <p>I have a dataframe with numeric and character columns and I would like to insulate to character vectors so that it doesn't return column name and factor levels when I select the data afterward. </p>
<p>My problem is that I create the dataframe wi... | <p>As mentioned in my command. If it is not needed, that name is a factor, what would work is the following: </p>
<pre><code>conf1 <- c(name = "conf1", num = 1, bool = TRUE)
conf2 <- c(name = "conf2", num = 10, bool = TRUE)
conf3 <- c(name = "conf3", num = 100, bool = FALSE)
</code></pre>
<p>And then instead... |
Property 'map' does not exist on type Object <pre><code>type MyStructure = Object[] |Â Object;
const myStructure: MyStructure = [{ foo: "bar" }];
myStructure.map(); // Property 'map' does not exist on type 'MyStructure'. any
</code></pre>
<p>The library either delivers an object or an array of this object. How can I... | <p>Because your type means you could have an object, or you could have an array; TypeScript can't determine which members are appropriate.</p>
<p>To test this out, change your type and you'll see the <code>map</code> method is now available:</p>
<pre><code>type MyStructure = Object[];
</code></pre>
<p>In your case, ... |
MYSQL UTF8_bin case insensitive unique index <p>I have some columns in MYSQL table that will contain unique strings in different languages and there are scenarios where some characters will match e.g. English A with Swedish A and MYSQL will treat them as equal.</p>
<p>So I am considering using <code>UTF8_bin</code> co... |
<p>You can use a generated column that will store the lower case version of your string, and use a unique index on that.</p>
<pre class="lang-sql prettyprint-override"><code>create table test_utf8_bin_ci
( u8 varchar(50) charset utf8mb4 collate utf8mb4_unicode_ci,
u8_bin_ci varchar(50) charset utf8mb4 collate utf8... |
I got segmentation fault in c inline assembly when I called jmp <p>I got an segmentation fault when I use <code>jmp</code>.</p>
<p>At the first time,I just used <code>jmp 0x30</code>, and I got segmentation fault.</p>
<p>I debuged my program by using gdb, and i saw that after <code>jmp</code> was called, it jump to a... | <p>I don't think the segmentation fault is caused by the <code>jmp L</code> instruction.</p>
<p>Look at what I did here:</p>
<pre><code>(gdb) b main
Breakpoint 1 at 0x80483be: file test.c, line 3.
(gdb) run
Starting program: /home/cad/a.out
Breakpoint 1, main () at test.c:3
3 __asm__("jmp L\n"
(gdb) display/i... |
Scala: memory usage for Stream and List across transformations <p>I have a doubt about how Scala allocates memory across transformations using <code>Stream</code> and <code>List</code>. Let's take a simple example like this written using both <code>Stream/List</code>:</p>
<pre><code>Stream(1,2,3,4,5).map(_ + 3).filter... | <p><em>Lazy evaluation makes it hard to reason about when things will be evaluated and Laziness does not work well with Side effects</em></p>
<blockquote>
<p>Memory consumption of lazy lists (in general lazy data structures) is hard to deal with because they result in accumulation of unevaluated thunks in the memory... |
Create NIO 2 FileSystem from current Jar <p>I'm trying to create <code>java.nio.file.FileSystem</code> from current Jar to extract something inside it. However, I couldn't get required Jar URI in any way. Which may be best way to do that?</p>
| <p>My goal was to copy some group of native files from current Jar to a known location. In that way, I first tried to create a FileSystem object from current Jar to use FileSystem's copy operation for easiness. However, it looks to me not easy and to make this happen, I got each resource as stream and copied them to cu... |
App is crashing while loading request in UIWebVIew - ObjectiveC <p>I am loading an URL to my <code>webView</code> but just after starting <code>loadRequest</code> my App is crashing.</p>
<p>My <code>WebView</code> is inside a custom <code>UIView</code> Class with <code>XIB</code> and I am adding my view like this:</p... | <p>Try to retype <code>nil</code> to <code>self</code> as the owner parameter. So you may have to replace:</p>
<pre><code>WebViewContainer *webViewContainer = [[[NSBundle mainBundle] loadNibNamed:@"WebViewContainer" owner:nil options:nil]
</code></pre>
<p>with</p>
<pre><code>WebViewContainer *webViewContainer = [[[... |
Masking + Rotation with CSS <p>I need to rotate a spinning wheel so that only one part (the same part) of the wheel is always visible. I am trying to accomplish this with a mask in <code>div1</code> while <code>div2</code> is rotated. </p>
<pre><code><div1 id="maskedDiv">
<div2 id="rotatedDiv">
</... | <p>I think what you are seeing is that the size of the rotated div's background is set based on the size of the parent div (the mask div). Then when you are rotating the inner div the edges will show through the mask and you might think that the mask polygon changes.</p>
<p>To get around this limitation make the paren... |
How to lock/unlock the screen with Pattern/Password mode in Android? <p>I was successful to lock/unlock my screen using <code>DevicePolicyManager</code> and <code>KeyguardManager</code> in Android L. It worked well when I lock/unlock screen using swipe mode (no security). However, I cannot lock/unlock it when I lock/un... | <p>The issue is likely to be that you are not calling the window from the context. </p>
<pre><code>keyguardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
</code></pre>
<p>Using <a href="http://archive.hackerferret.com/2011/10/locking-and-unlocking-android-phone.html" rel="nofollow">the following snip... |
GraphAPIError: An active access token must be used to query information about the current user <p>On Facebook GraphAPI, with the Python SDK, I am trying to send a notification to a user. I receive the error:</p>
<pre><code>GraphAPIError: An active access token must be used to query information about the current user ... | <p>Solution:</p>
<pre><code>graph = facebook.GraphAPI(access_token=TOKENS["user_token"])
user_info= graph.get_object(id='me', fields='id')
graph = facebook.GraphAPI(access_token=TOKENS["app_token"])
graph.put_object(parent_object= user_info['id'], connection_name='notifications', template='Tell us how you like the ... |
pass PHP Variable to JS <p>Seems like a trivial problem with an apparently easy solution. I have a PHP file which is loaded via a post. In this document I can retrieve the posted value as such: </p>
<pre><code>$userid = $_POST["userid"];
</code></pre>
<p>Then in my Javascript in <code>$(document).ready(function()</c... | <p>There are two approaches for this:</p>
<p>First if your js is present inside a php file then in that case.</p>
<pre><code>var jsvariable = "<?php echo $_POST["userid"]; ?>";
</code></pre>
<p>And if your js is present in a .js file then in that case. </p>
<pre><code>var jsvariable2 = "<?php echo $_POST[... |
When using Implicit Flow with a SPA, where do we actually create the account in our Database? <p>I'm trying to understand how OAuth2.0 Implicit Flow (with OIDC) works with a pretty simple SPA/Mobile client (aka Client) and my REST Api (aka. Resource Server) <strong>& creating new accounts</strong>.</p>
<p>I more o... | <blockquote>
<p>where do we actually create the account in our Database?</p>
</blockquote>
<p>Create a database table that includes an <code>iss</code> and <code>sub</code> column. Setup those columns as a unique compound key that represents a user. Insert user accounts in there. </p>
<blockquote>
<p>So, can anyo... |
Cannot resolve the name 'common:DateRange' to a(n) 'type definition' component <p>I have two xml schema files schema1.xsd schema2.xsd.
schema2.xsd is imported inside schema1.xsd
Whan i try to parse schema1.xsd in JAXB as the following:</p>
<pre><code>Schema schema = factory.newSchema(new StreamSource(schemaString));
<... | <p>Issue solved when i defined the full path of the schema2.xsd path</p>
|
return zero count values mysql with groupby <p>the query attached doesn't return zero values for each yearweek of a date, How can I return zero values , results expected :</p>
<ul>
<li>201802 1 1</li>
<li>201801 2 <strong>0</strong></li>
<li>201753 0 1</li>
</ul>
<p>instead of </p>
<ul>
<li>201802 1 1... | <p><br>Hi Mostafa,<br> You can use the below query,</p>
<pre><code>SELECT Yearweek(`date`) AS yweek_m,
Week( `date` ) AS weekperiod_m,
Count(id_xx) AS cnt_m
FROM measurementview MV
LEFT OUTER JOIN woundview WV
ON MV.wound_id_wound = WV.id_wound
LEFT OUTER JOIN activepatientview AV
ON WV.... |
Calculate sklearn.roc_auc_score for multi-class <p>I would like to calculate AUC, precision, accuracy for my classifier.
I am doing supervised learning:</p>
<p>Here is my working code.
This code is working fine for binary class, but not for multi class.
Please assume that you have a dataframe with binary classes:</p>... | <p>You can't use <code>roc_auc</code> as a single summary metric for multiclass models. If you want, you could calculate per-class <code>roc_auc</code>, as </p>
<pre><code>roc = {label: [] for label in multi_class_series.unique()}
for label in multi_class_series.unique():
selected_classifier.fit(train_set_datafram... |
Looking up a "key" in an 8GB+ text file <p>I have some 'small' text files that contain about 500000 entries/rows. Each row has also a 'key' column. I need to find this keys in a big file (8GB, at least 219 million entries). When found, I need to append the 'Value' from the big file into the small file, at the end of th... | <p>Instead of re-inventing the wheel of binary search or B-Tree, try with an existing implementation.</p>
<p>Feed the content into a SQLite3 in-memory DB (with the proper index, and with a transaction every 10,000 INSERT) and you are done. Ensure you target Win64, to have enough space in RAM. You may even use a file-b... |
Including directory and keep it working php <p>I'm using Codeigniter and facing the following problem.</p>
<p>In a controller, I want to include in some way an application (Not written in Codeigniter) in my controller. I am using file_get_contents now. It's working fine and the application is shown in the controller I... | <p>You can load your external php pages in a iframe but i would suggest you should convert your php files to codeigniter MVC structure to get the advantages.</p>
<p>The quick way is using iframe,but i would ask you to refer this post to get an idea on Iframes when to use & when not to.
<a href="http://stackoverflo... |
How to send large response with play scala <p>I am using play framework 2 with Scala. From the controller I have a action method from where I need to return an object containing 100000 rows with some other data. But during JSON serialization it gets an exception at
org.json4s.native.Serialization.write(Serialization.sc... | <p>Chunked response can be used to send large dataset, especially the total bytes length is not known when starting sending a response. It only consumes a small amount of memory because it streams data chunk by chunk.</p>
<p><a href="https://www.playframework.com/documentation/2.5.x/ScalaStream#chunked-responses" rel=... |
Loading async image in Angular2+Electron app after selecting directory from dialog <p>So I have the following in an Electron+Angular2 app:</p>
<pre><code>import {Component} from '@angular/core';
import * as fs from "fs";
import {ImageFile, KeepAction, RetouchAction, PrivateAction, DeleteAction} from "./components/imag... | <p>I was able to solve this using a <code>Promise</code> and resolving it after both the <code>showOpenDialog</code> and <code>readdir</code> callbacks were executed.</p>
<p><strong>TLDR</strong>: </p>
<pre><code> openDir() {
new Promise((resolve, reject) => {
dialog.showOpenDialog({defaultPath... |
textarea value and text attributes goes on undefined in react <p>I have a textarea</p>
<pre><code><textarea ref="newText" defaultValue={this.props.children}></textarea>
</code></pre>
<p>I need to fetch its value,I tried like this.</p>
<pre><code>this.props.update(this.refs.newText.value,this.props.index)... | <p>It's hard to debug without the full source code of your component. I've prepared a codepen which shows two ways of accessing the value entered in the <code><textarea/></code> element: <a href="http://codepen.io/PiotrBerebecki/pen/amJAqb" rel="nofollow">http://codepen.io/PiotrBerebecki/pen/amJAqb</a><br/><br/><... |
Create HTML forms dynamically using AngularJS <p>I'm working on a big project which contains more then 80 forms. Each transaction having one form, now I think about creating this forms dynamically using Angular. This dynamic form creation process will generate input field with their model name and validation rules. The... | <p>If you are using asp.net as backend, then you can depend on visual studio scaffolding and T4 templates to generate the HTML and JavaScript for your Angular Controllers and Views.</p>
<p>Otherwise, you can have a Json file that has the list of fields for each form and create a directive that accepts the name of the ... |
How to install grub after installing Windows 10 <p>I recently install Linux Mint (KDE Plasma) on my SSD (30GB Partition) after that I install Windows 10 on remaining storage. But when I tried to boot in Linux Mint my Computer automatically boot Windows 10 without showing Boot options for selecting OS. Now, how to insta... | <p>Windows will overwrite the boot sector whenever you install it. In general install windows first then linux. You can repair the grub by booting from a live disk of linux Mint and there should be an option to repair-boot, which will repair your grub. Restart it and now you should be able to see both the OS.</p>
<p>O... |
addEventListener return value in Angualr controller <p>I have the following function in the controller: </p>
<pre><code> vm.trasformaController = function(){
document.getElementById("document")
.addEventListener("change", handleFileSelect, false);
f... | <p>I solved this by:</p>
<pre><code>scope.$apply(function(){
scope.refertazione.result = result.value;
})
</code></pre>
|
WPF MVVM ComboBox color <p>I want to change background color of my ComboBox. I mean background color of the comboBox, not items in popup list, see the picture. That's all I need! Why this is so difficult to do!? Why this doesn't work out of the box? I would like to find solution in MVVM-approach, without hacks in code-... | <p>If you look at the default style you'll understand why it <em>doesn't work out of the box</em>. See below where <code>CustomBrush1</code> is applied to change the color you want:</p>
<pre><code> <Window.Resources>
<SolidColorBrush x:Key="CustomBrush1" Color="#2fff0000"/>
<Style x:Key="Fo... |
how to make sorted list of the 3 numbers in ascending order in lisp <p>I am trying to make sorted list of the 3 numbers in ascending order in lisp.
But i got error like "Incorrect number of arguments to if" when compiling and load.</p>
<pre><code>(defun order (n1 n2 n3)
(if (>= n1 n2)
(progn(progn(if (... | <p>Here is a possible solution:</p>
<pre><code>(defun order (min mid max)
(when (< mid min)
(rotatef mid min))
(if (< max min)
(rotatef max mid min)
(when (< max mid)
(rotatef mid max)))
(list min mid max))
</code></pre>
<p>First, we assume that the three parameters are already ... |
How to create component inide other component in Angular2 <p>I need to split one complicated component into two or more simplier using directives in template.</p>
<p><a href="http://i.stack.imgur.com/Y0dPn.png" rel="nofollow"><img src="http://i.stack.imgur.com/Y0dPn.png" alt="enter image description here"></a></p>
| <p>Here is the way how to implement this.</p>
<p><strong>MainComponent.ts</strong></p>
<pre><code>import { Component } from '@angular/core';
import { MyService1 } from '../../providers/myService1/myService1';
import { MyCmp1 } from '../../components/myCmp1/myCmp1';
@Component({
templateUrl: 'build/pages/mainCompo... |
Unity 5.4 UNetWeaver error: ResolveMethod failed <p>I am having this error even in empty projects.</p>
<p>i am using Unity 5.4.03</p>
<pre><code>UNetWeaver error: ResolveMethod failed NetworkBehaviour::SendTargetRPCInternal UnityEngine.Networking.NetworkBehaviour
UnityEngine.Debug:LogError(Object)
Unity.UNetWeaver.Lo... | <p>the way it worked for me was removing the old installation of Unity that I still had on the mac. Also, I removed Unity 5.4.1 and installed 5.4.1 again now on a complete Unity free system.
That made the error disappear.</p>
|
remove string between parentheses [iOS] <p>i have a NSString with parentheses in it.
I would like to remove the Text inside of the parentheses.
How to do that? ( In Objective-C )</p>
<p>Example String:</p>
<blockquote>
<p>Tach auch. (lockeres Ruhrdeutsch) Und Hallo!</p>
</blockquote>
<p>I would like to Remove "(lo... | <p>Use regular expression:</p>
<pre><code>NSString *string = @"Tach auch. (lockeres Ruhrdeutsch) Und Hallo!";
NSString *filteredString = [string stringByReplacingOccurrencesOfString:@"\\(.*\\)"
withString:@""
... |
How to extract values from jquery `formData` to insert into Mysql? <p>My code is about submitting a <code>multipart form</code>, through <code>$.ajax</code>, which is successfully doing it & upon <code>json_encode</code> in <code>submit.php</code> , its giving me this :</p>
<pre><code>{"success":"Image was submitt... | <p>If you're using POST method in ajax, then you can access those data in PHP. </p>
<pre><code>print_r($_POST);
</code></pre>
<p>Form submit using ajax.</p>
<pre><code>//Program a custom submit function for the form
$("form#data").submit(function(event){
//disable the default form submission
event.preventDefault... |
web-console is not working in all views on Rails 5 <p>To have web-console available on all pages (not just the error pages), I added the following line:</p>
<pre><code><%= console %>
</code></pre>
<p>in <em>app/views/layouts/application.html.erb</em></p>
<p>The problem is that the web-console shows up in all p... | <p>The problem was caused by the following line in the controller that did not work.</p>
<pre><code>include ActionController::Live
</code></pre>
<p>Commenting this line solved the problem. It seems that web-console does not work with controllers that have ActionController::Live included. Will move the 'actions' that ... |
control iframe src page is divs <p>is there any way i could control divs on pages that is in iframe src using php or javascript?</p>
<p>for example on my page i have iframe and when page loaded and there must be a button when i clicked on it, it will remove the div that is on page on iframe src</p>
<p>hope you unders... | <p>if the page which is on iframe on the same domain you use you can access the box element as any other element in the page
example to what you want to do:</p>
<pre><code>$('#button').on('click', function(){
$("#iframeID").contents().find("#box").css('display', 'none');
// or if you want to remove it
$("#... |
How to set username and password for phpmyadmin <p>When I go to <code>localhost/phpmyadmin</code>, it shows like this:</p>
<p><a href="http://i.stack.imgur.com/bfgPh.png" rel="nofollow"><img src="http://i.stack.imgur.com/bfgPh.png" alt="enter image description here"></a></p>
<p>But how to set the username and passwor... | <p>Try to search for a file called: <strong>config.inc.php</strong> in your system and open it with an editor of your choice. </p>
<p>Then either search for <code>$cfg['Servers'][$i]['AllowNoPassword']</code> and set it to True: <code>$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;</code> (<strong>Attention:</strong> u... |
how to copy file from local to sharepoint site usins SSIS Or Script Task of ssis <p>I tried with the C# code mention in one of the site and used Microsoft.Sharepoint.client dll in refrence ,still I am getting and red underline on SPSite and SPWeb.
Can you please help where I am doing mistake or any alternative way to d... | <p>The couple places I have a need for this, I just use a data flow to export a file to the windows explorer path of the sharepoint site folder I need the file in.</p>
|
Django custom user model, with unique togethr - tenant and username <p>I am making a multi tenant app on Django, where I want the user model to be unique together on "tenant" (foreign key to tenant model,having the tenant details) and "username", ie something like - unique_together =("username", "tenant") or any of its... | <p>Django user model need "username" to be unique, therefore I will suggest to use another field to replace the username such as "email" which i believe you want to keep unique</p>
<p>In order to do that you need to override the user model and change the username field</p>
<p>USERNAME_FIELD = 'email'</p>
|
proportionaly find values between 2 numbers <p>Need a bit of help here please, on probably simple thing. </p>
<p>How do I find numbers in column B between B1 (330) and B6 (260) for values in A? </p>
<pre>
A B
1 0.35 330
2 0.36
3 0.37
4 0.38
5 0.39
6 0.4 ... | <p>You need to do a linear interpolation. First we will get the equation for the line from the two outside points:</p>
<pre><code>Equation: y = m * x + b
m: =SLOPE(y,x)
b: =INTERCEPT(y,x)
</code></pre>
<p><a href="http://i.stack.imgur.com/plYHg.png" rel="nofollow"><img src="http://i.stack.imgur.com/plYHg.png" alt="e... |
Python program that sends txt file to email <p>I've recently created a python keylogger. The code is :</p>
<pre><code>import win32api
import win32console
import win32gui
import pythoncom,pyHook
win=win32console.GetConsoleWindow()
win32gui.ShowWindow(win,0)
def OnKeyboardEvent(event):
if event.Ascii==5:
_exit(1)
... | <p><a href="https://docs.python.org/3/library/email-examples.html" rel="nofollow">The python docs has good documentation of emails in python.</a></p>
<pre><code># Import smtplib for the actual sending function
import smtplib
# Import the email modules we'll need
from email.mime.text import MIMEText
# Open a plain te... |
How build an index from MSSQL server to Postgres? <p>I have Index from MsSQL server like this: </p>
<pre><code>CREATE NONCLUSTERED INDEX [ClickedCampaigns_UserId] ON [dbo]. [CookieUserRtbMathings]
(
[UserId] ASC
)
INCLUDE ( [Id])
</code></pre>
<p>As I know there is no "Include" in Postgres, So how I can conv... | <p>As this is not a unique index, you can simply add that column to the index:</p>
<pre><code>CREATE INDEX clickedcampaigns_userid
ON dbo.cookieuserrtbmathings(userid, id);
</code></pre>
|
Page scroll down automatically on refresh in Internet explorer <p>Internet explorer scrolls down the page automatically on page refresh and puts focus where I was before refresh. I have tried following things to override this behavior BUT nothing worked : </p>
<pre><code>$(window).on('beforeunload', function() {
$... | <p>This should work in all browsers... </p>
<pre><code>$(window).on('load', function() {
$(window).scrollTop(0);
});
</code></pre>
|
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding <p>I am getting below Stack Trace when I generate a report. Report has been design with RDLC and it is connect with XSD file. XSD file generate query with SQL Stored Procedure. This report works perfectly bu... | <p>I think the reason is due to large number of data in that specific report in that case just add this line in ReportViewer.aspx.cs page </p>
<pre><code>adapter.SelectCommand.CommandTimeout = 0;
</code></pre>
<p>but if you are having large amount of data it will take some time but it will work</p>
|
NSNumberFormatter for degrees' values <p>Is there any proper implementation for <code>0°00'00.00"</code> format?
<code>NSNumberFormatter</code> supports only <code>groupingSeparator</code> and <code>decimalSeparator</code>.
Or not?</p>
| <p>There is no degree-minute-second formatter in Foundation but it's not too hard to roll your own. Here's my crude attempt:</p>
<pre><code>class DegreeFormatter : NumberFormatter {
func string(from degree: Double) -> String {
var remaining = degree
let degree = remaining.rounded(.towardZero)
... |
MongoDB NodeJS update removes attributes <p>When I'm trying to update a single attribute of a user's document after the update query every attribute of the user is missing except the _id and updated attribute. What's wrong with my query?</p>
<pre><code>dbwrapper.mongo.getConnection().then(function(db){
db.collecti... | <p>That's how updates work with MongoDB: if the second ("update") document contains <em>only</em> <strong>field:value</strong> expressions, the document stored in the database will be <em>replaced</em> by the update document. This is <a href="https://docs.mongodb.com/manual/reference/method/db.collection.update/#replac... |
How to remove `/index.php` from all urls, including the last trailing slash? <p>I've been looking around the web and especially here on stackoverflow for THE answer to this question.</p>
<p>I only use <strong>directories</strong> with an <code>index.php</code> file in it. Includables and private stuff are outside the ... | <p>You can use these rules to meet all the requirements including removal of <code>index.php</code>. Do remember that anchors cannot be preserved on server side as server won't even get <code>#anchor</code> in the HTTP request i.e. only <code>http://domain.com/sub/</code> will be received in Apache logs.</p>
<pre><co... |
GridView throwing null on child id <p>My gridview is throwing null on asking for child id, i have looked to similar question but my view is not scroll able so no child view is reused . I want that after gridview appears on screen few random child change their colour . I have kept the code in on start as on start does t... | <p>int widthofactivity was not there so it took the default 0 ; becuase of which gridview object got crested but no gridview and there no child. and i have attached viewtreeobserver with gridview then wrote the code in global layout method</p>
|
Merge the arrays <p>I have two arrays <code>$array</code> and <code>$array2</code>. I need to merge them on behalf of common key value i.e. entry_id.
Well I need to merge them is such a way that if the entry_id of array 1 matches with the entry_id of array2, it merges. If the entry_id doesn't match that array remains ... | <p>You could apply this <a href="http://php.net/manual/en/function.array-reduce.php" rel="nofollow"><code>array_reduce</code></a> call to the <code>array_merge</code> result:</p>
<pre><code>$result = array_reduce(array_merge($array, $array2), function ($acc, $el) {
$key = $el['entry_id'];
$acc[$key] = isset($a... |
Some problems appear when i use Macro variable <pre><code>data classivar_1;
set classvar;
AnaClassVar=scan(scan(F2,1," "),2,".");
run;
proc sql;
select AnaClassVar into : MacClassVar separated by "#" from classivar_1 ;
select count(*) into: Count_classvar from classivar_1;
quit;
%put &MacClassVar.;
%put &Count_... | <p>In %ClassAna you are conditionally creating the macro vars based on:</p>
<pre><code>%if %sysfunc(find(%scan(&MacClassVar,&i,#),%scan(&AllVar,&count,#)))
%then %do;
</code></pre>
<p>That FIND is case sensitive by default. I think it will work if you make it case insensitive by adding the optional i ... |
Python function that behaves differently depending on the input object types <p>In Python, can I write a function that takes objects as inputs and performs different calculations depending on the types of the objects?</p>
<p>For example, say I have two classes: "circle" and "line". I define a circle object A with a ra... | <p>Yes, you can certainly detect the types of your Python objects and execute different behaviour based on that. The built-in <code>type()</code> method will provide the information you need.</p>
<p>I should stress that this is rather reverting to the procedural paradigm whereas what you may be better off doing in loo... |
Memory allocation using calloc <p>I want to initialize my large 2D array to zero.
if i allocate memory through calloc it will automatically initialize all the cells to zero.
Whether it is possible to allocate memory for 2D array using single calloc function ?
Thank you</p>
| <p>If you want to be able to access the matrix elements by using the <code>[]</code> operator, you'll have to first allocate an intermediate structure that contains pointers to the data stored on each row of the matrix.</p>
<p>Each row will be zeroed because they're allocated using <code>calloc()</code>. Is this what ... |
Apache POI default style for workbook <p>I am trying to change the default cell style for an entire Excel workbook (<code>XSSF</code>) using <code>Apache POI</code>. This should be applied to new cells a user might create (after the workbook has been saved by <code>POI</code>). I am trying to do this by calling <code>w... | <p>There are two possibilities to achieve this with XSSF.</p>
<p>First: If you select all cells in a XSSF worksheet in Excel and apply a style to them, then a <code>cols</code> element is added to the sheet with a style definition for all columns:</p>
<pre><code><cols>
<col min="1" max="16384" style="1"/>... |
How to create endless fragments to work with dates? <p>I have seen other similar questions but cannot seem to get my head around a few things:</p>
<p>Here is what I am trying to achieve</p>
<p><a href="http://i.stack.imgur.com/rQTnF.png" rel="nofollow"><img src="http://i.stack.imgur.com/rQTnF.png" alt="enter image de... | <p>On click of arrow (< or >), you can create <code>onClick</code> listner and based on that you can do some operations as well as if you are using calender
in that selecting date than also you can create <code>onClick</code> listner for that.</p>
<p>Basically the performance would depends on:</p>
<ul>
<li>How big... |
Getting Column Headers from multiple html 'tbody' <p>I need to get the column headers from the second tbody in this url.</p>
<p><a href="http://bepi.mpob.gov.my/index.php/statistics/price/daily.html" rel="nofollow">http://bepi.mpob.gov.my/index.php/statistics/price/daily.html</a></p>
<p>Specifically, i would like to ... | <p>When you click "View Price" button a POST request is sent to the <code>http://bepi.mpob.gov.my/admin2/price_local_daily_view3.php</code> endpoint. Simulate this POST request and parse the resulting HTML:</p>
<pre><code>import requests
from bs4 import BeautifulSoup
with requests.Session() as session:
session.g... |
Can't select from mysql table <p>I have following database:</p>
<p><a href="http://i.stack.imgur.com/WwKw3.png" rel="nofollow"><img src="http://i.stack.imgur.com/WwKw3.png" alt="enter image description here"></a></p>
<p>I want to select all columns from 'catalog' table. Used this code, but it doesn't work. </p>
<pre... | <p>You are closing connection before fetching data from database. use <code>mysqli_close($link);</code> after your while loop.</p>
|
javascript function inside an object difference <p>in short,
what's the difference between </p>
<pre><code>var MyModule = {
func: function() {}
};
</code></pre>
<p>and</p>
<pre><code>var MyModule = {
func: function f() {}
};
</code></pre>
<p>I used to use the first way. But when I see angular docs it's is usu... | <p>There is no difference in how this code is executed, but the second version can help you with debugging. If you see a stacktrace for some error with first version you will see info about some anonymous function and in second version you will see function name.</p>
<p>ESLint has a rule for this convention. You can r... |
Plot islands as dots on world map <p>I'm using <code>rworldmap</code>to create a world map to show data. For my data, the small island states are quite important, but they are too small to see when the entire world is shown. So I'd like to have a small visible dot/circle at the location of the island nations in the col... | <p>Thanks to <code>lmo</code> for pointing me in the right direction, I now found a solution. I'll provide the answer here including a reproducible example. I also think I have to explain one extra bit of the question I didn't make clear enough. I want all countries of the world to be plotted to get a world map. Then, ... |
Consistent builds / remove personal information from binaries <p>I've now realized that Go saves absolute paths to source code in binaries for the purpose of printing stack-traces and the likes. I don't want to completely remove this information, however, this also means that every developer building the same program ... | <p>I know it doesn't <em>directly</em> address what you asked, but @JimB's suggestion does indicate a class of solutions to the problem you seem to be having.</p>
<p>One of the easier ones (I think) would be to have your developers install <a href="https://www.docker.com/products/overview" rel="nofollow">Docker</a> an... |
How to align two different labels to center? (Windows Form App) <p>I have two labels on my screen. One must be a little higher than another. I can't combine them to one because of different formatting, so I set Dock property to Fill and its not working (one label overlaps another).</p>
| <p>The <code>TextAlign</code> property on the label will align the text with respect to its own size. If <code>AutoSize</code> is set to <code>true</code> the size will be as small as possible so you won't see any changes for alignment. </p>
<p>Try setting <code>AutoSize</code> to <code>false</code>, <code>TextAlign</... |
How to store possible values of a variable in local macro? <p>I want to store the distinct values of a variable of my dataset in a local macro. I thought that there could be a way using a function as <code>table</code> and storing some <code>r()</code>. But I could not find any function with an useful <code>r()</code>... | <p>As suggested by William Lisowski in comments, <code>levelsof</code> does this.</p>
<p>In my example code would be:</p>
<pre><code>sysuse auto
levelsof foreign
local foreign_distinct_values = r(levels)
</code></pre>
<p>or with a categorical variable:</p>
<pre><code>levelsof make
local make_distinct_values = r(lev... |
Can't post OpenGraph story: OAuthException, An unknown error has occurred, Test user <p>I'm trying to post an OpenGraph story to Facebook. <code>publish_actions</code> was not yet approved(nor submitted for approval yet), but I am using a test user for that app, so it should work. Here is my code:</p>
<pre><code>let l... | <p>Turns out it must be <code>"og:type": "testapp:location"</code> instead of <code>"og:type": "location"</code>...</p>
|
Keep height of children div constant? <p>I wish to keep the height of the two children div's, <code>abc</code> and <code>def</code> constant, and each with height half that of their parent, <code>xyz</code>. I was able to do this using <code>flex</code> in CSS, but in each of the child div <code>abc</code> and <code>de... | <p>If you are using a <code>flexbox</code> to get the overflow, you should wrap the flexbox child's contents into an <code>absolute</code>ly positioned contanier so that it can scroll on overflow.</p>
<p>So here is the summary of what I've changed in your code:</p>
<ol>
<li><p>To demonstrate the overflow, set a speci... |
skip function arguments javascript <p>For example I have this function</p>
<pre><code>function example(a=1,b=1,c=1,d=1,f=1) {
return (a*b*c*d*f)
}
</code></pre>
<p>So I have simple function with parameter which have default value.
And now when I call the function if I want to multiply a with <code>f</code>. I need t... | <blockquote>
<p>Why I can't simply write first and last argument...</p>
</blockquote>
<p>Because that isn't how function calls are defined in the JavaScript specification. That's the only reason.</p>
<p>I would suggest passing an object whenever you are not sure about the number of argument you are going to pass to... |
How to get info from website once logged on with HTMLUNIT? <p>I have made a post before about this but have gained some more details on how to do it, yet i am still unable to do it properly. This is the main part of code. When i run it i get a whole bunch of warnings related to css in the console. And it wont work. Im ... | <p>You most likely do not need the CSS so you could disable it.</p>
<p>To improve performance and reduce warnings and errors I disable/limit as much as possible.</p>
<pre><code> webClient.setJavaScriptTimeout(30 * 1000); // 30s
webClient.getOptions().setTimeout(300 * 1000); // 300s
webClient.getOptions().s... |
How do you display advanced custom fields on taxonomy terms? <p>In my archive page I added the following code:</p>
<pre><code> <p><?php the_field('embed', $term); ?></p>
<p><?php the_field('download_output', $term); ?></p>
</code></pre>
<p>On the front-end when i'm on the archive ... | <p>Here is the documentation for ACF terms: <a href="https://www.advancedcustomfields.com/resources/get-values-from-a-taxonomy-term/" rel="nofollow">https://www.advancedcustomfields.com/resources/get-values-from-a-taxonomy-term/</a></p>
<p>And the term should be in this format: {$term->taxonomy}_{$term->term_id}</p>
|
Typescript Shorthand ambient modules <p>Here is the piece of code from <a href="https://www.typescriptlang.org/docs/handbook/modules.html" rel="nofollow">official guide about module</a>. </p>
<pre><code>import x, {y} from "hot-new-module";
x(y);
</code></pre>
<p>I don't understand the syntax. Why x is not in the curl... | <p><code>x</code> is the default export. <code>y</code> is a named export.</p>
<p>Module.ts</p>
<pre><code>export class y { }
const x = (someVar: y) => { /* */ };
export default x;
</code></pre>
<p>This is imported with your syntax</p>
<pre><code>import x, {y} from "hot-new-module";
x(y);
</code></pre>
|
Find difference in list with identical values <p>I need to be able to find differences in list that may have identical values to one another besides two added elements</p>
<p>example</p>
<pre><code>a = ['cool task', 'b', 'another task', 'j', 'better task', 'y']
b = ['cool task', 'b', 'a task', 'j', 'another task', 'j... | <p>For <strong>simple list</strong> - what you ask is simply searching for that next item in the list:</p>
<pre><code>>>> a = ['cool task', 'b', 'another task', 'j', 'better task', 'y']
>>> b = ['cool task', 'b', 'a task', 'j', 'another task', 'j', 'better task', 'y']
>>> c = [[x, b[b.index(... |
Do 16-bit programs run in Virtual 8086 Mode on a 32-bit OS? <p>I want to confirm a few things. I am making assembly language programs for 8086.
I am assembling using masm611 assembler. If i run and debug the 8086 16bit real mode program under command prompt in 32 bit windows, Does it use and modify the actual cpu regis... | <p>When you run an MS-DOS program from the Windows command prompt under a 32-bit version of Windows it's run under NTVDM which uses virtual 8086 mode to emulate real mode. The program, when running, uses the CPU's registers as normal. However, it doesn't use memory in same way that code running in real mode would. </p>... |
Can the size of an N-dimensional array change in Java? <p>An array in Java is an object. So if I have a 2D array <code>double[][] matrix = new double[5][5]</code> then each row of that array is an object referencing a single dimensional array in memory. From my understanding, once the array size is set in java it can n... | <p>The assignment </p>
<pre><code>double[][] matrix = new double[5][5];
</code></pre>
<p>actually creates 6 array objects. One array whose element type is <code>double[]</code> (i.e. an array of double arrays) having a length of 5 and referenced by the <code>matrix</code> variable, and 5 arrays whose element types ar... |
gps.getLasknowlocation returns null in emulator even after setting the location? <p>The question is self explainatory. On debugging I see the location as null. Please suggest what further to triage.</p>
<pre><code>locationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
// ... | <p>Based on the code, I'm assuming you're using GPSTracker or some derivation of it (which you shouldn't that code is broken). If so, the gpsEnabled value just tells you whether its possible to use GPS, not whether its actually on and capable of giving you a value right now.</p>
|
Perl Remove invalid characters, invalid latin1 characters from string <p>I have a perl script that reads from a web service and saves in a mysql table. this table uses latin1. from the web service there are coming some wrong characters and need to remove them before saving them in the database, otherwise they get saved... | <p>If you just want to remove the characters outside the 7-bit ascii set (which are sufficient to display messages in english), you can you do this:</p>
<pre><code>$desc=~s/[^\x00-\x7f]//g
</code></pre>
<p><strong>Edit</strong>: If you want something more elaborate that supports the entire <code>latin-1</code> set, y... |
Angular 2 forms + OnPush <p>I am writing an angular 2 application where I try to use ChangeDetectionStrategy.OnPush everywhere, for performance reasons. I have a complex component that needs OnPush in order to work smoothly, which contains another component that is displaying a form (created with FormBuilder). I now no... | <p>Not tested myself but invoking change detection manually might do what you want:</p>
<pre><code>@Component({
...
})
class MyComponent implements OnInit {
constructor(private cdRef: ChangeDetectorRef) {}
ngOnInit() {
INIT_FORM();
this.form.valueChanges
.subscribe(() => {
this.cdRef.detectChan... |
Get the array file names order by name files c# <pre><code>DirectoryInfo d = new DirectoryInfo(mypath);//Assuming Test is your Folder
FileInfo[] Files = d.GetFiles("*.jpg"); //Getting Text files
</code></pre>
<p>How the files array could be order by name?</p>
<p>let's say </p>
<pre><code>files[0].Name is 'hi1.jpg'
f... | <p>It is just a call to <a href="https://msdn.microsoft.com/en-us/library/bb534966(v=vs.110).aspx" rel="nofollow">OrderBy</a> in Linq namespace</p>
<pre><code>using System.Linq;
....
FileInfo[] Files = d.GetFiles("*.jpg").OrderBy(x => x.Name).ToArray();
</code></pre>
<p>By the way, I suggest you to use EnumerateF... |
How to add Price field to Odoo Product template? <p>I am using this free Odoo data slider module on website.
<a href="https://www.odoo.com/apps/modules/9.0/website_snippet_data_slider/" rel="nofollow">https://www.odoo.com/apps/modules/9.0/website_snippet_data_slider/</a>
A nice module and works well too.I need to add "... | <p>Basically you need to map the value of the price to an html element. I have not tested this however if you take a look at data_slider.js just follow what is done for the display_name (product name <code>data_name_field</code>) from top to bottom. </p>
<p>You will also want to do some formatting for currency and so ... |
SSL not work in PHP5.6 on Windows <p>I tried:</p>
<pre><code>$host = 'ssl://fbcdn-sphotos-c-a.akamaihd.net';
$port = 443;
$fp = fsockopen($host, $port, $errno, $errstr, 30);
if (!$fp) {
var_dump($errno, $errstr);
} else {
echo 'Connected';
}
</code></pre>
<p>And:</p>
<pre><code>$host = 'ssl://fbcdn-sphotos... | <p><a href="http://php.net/stream_socket_client" rel="nofollow">http://php.net/stream_socket_client</a></p>
<blockquote>
<p>If the value returned in <code>errno</code> is <code>0</code> and the function returned <code>FALSE</code>, it is an indication that the error occurred before the [system-level] <code>connect()... |
PHP upload to certain folder based on HTML checkbox <p>Im new to PHP and still learning, but I want to know if I am able to do something like this. I have a basic HTML form like the one below.</p>
<pre><code><form action="upload.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:&... | <p>You can use the condition like this so that than only you can get the checkbox value after the form is submitted.</p>
<pre><code>if(isset($_POST['check']))
{
$filepath = "upload/private" . $randprefix . $_FILES["file"]["name"];
}
else
{
$filepath = "upload/public" . $randprefix . $_FILES["file"]["name"];
}
... |
How do you request user input using Rx? <p>I am writing a class that encapsulates a state machine that represents my applications attempts to communicate with my own web service. Basic states are disconnected, connecting, connected, and requiring credentials. I thought for good learning experience about using Rx to pub... | <p>If you're not using tasks or await, or anything asynchronous, Rx subscription code will observe on the same thread, and block if you're using blocking code. If you don't care about the input, then you can do a straight <code>Subscribe</code>. If you want to use the inputted username/password, then you can use <code>... |
Maven: Fails to detect package in dependency <p>I have a simple test maven project (on Eclipse Neon) in which I try to link to a class on another jar of mine.</p>
<p>The project structure is displayed on the following image:</p>
<p><a href="http://i.stack.imgur.com/ViDbV.jpg" rel="nofollow"><img src="http://i.stack.i... | <p>Just "clean project" (project menu -> clean) and everything will be fine. Eclipse restart can be helpfull as well. This is typical Eclipse issue that happens to me from time to time.</p>
<p>In general:
If your project compiles fine from the console (<code>mvn clean compile</code>) then you can ignore such Eclipse a... |
string[*,*] does not contain a definition for 'Contains' <p>I have a function that checks if a 2-dimensional string array contains a specific string value using <code>.Contains</code>. <code>System.Linq</code> is being used, as seems to be the problem in similar questions, however I still get the error of: </p>
<block... | <p>Though the answer of Adil Mammodov appears to work, it is not very general. I would have preferred to write this as the much shorter and more flexible:</p>
<pre><code>public static IEnumerable<T> ToSequence<T>(this T[,] items)
{
return items.Cast<T>();
}
</code></pre>
<p>And now you can simply ... |
Swift fetchRequest with multiple sortDescriptors and Bool filter <p>I am fetching from core data. I have an attribute that is a bool that is saved with a time attribute. I need to return an array of dates where the bool is true. I cannot get it to work, I either get an array of empty dates or it crashes.</p>
<pre><cod... | <p>If you are returning a <code>Date</code> and a <code>Bool</code> the return value cannot be <code>[[String:Date]]</code></p>
<pre><code>let results = try managedObjectContext.fetch(fetchRequest) as! [[String:Any]]
</code></pre>
<p>Instead of filtering the items in code add the filter condition to the predicate </p... |
For a np.array([1, 2, 3]) why is the shape (3,) instead of (3,1)? <p>I noticed that for a rank 1 array with 3 elements numpy returns (3,) for the shape. I know that this tuple represents the size of the array along each dimension, but why isn't it (3,1)?</p>
<pre><code>import numpy as np
a = np.array([1, 2, 3]) # Cr... | <p>In a nutshell, this is because it's <em>one</em>-dimensional array (hence the <em>one</em>-element shape tuple). Perhaps the following will help clear things up:</p>
<pre><code>>>> np.array([1, 2, 3]).shape
(3,)
>>> np.array([[1, 2, 3]]).shape
(1, 3)
>>> np.array([[1], [2], [3]]).shape
(3... |
CRUD,edit manually a user FOSUserBundle Symfony <p>i am trying to edit my user, and i get no errors when i submit, but the user is not updated in the DB.</p>
<p>i was wondering that, if the admin make some changes in the user(the other fields, not password), it will persist the user with the old password, and if the a... | <p>You have to use FosUserBundle Manager service, according to this : <a href="http://stackoverflow.com/questions/9183368/symfony2-user-setpassword-updates-password-as-plain-text-datafixtures-fos">Fos User Manager Service</a>.</p>
|
How does multithreading method invocation work <p>I am using java.</p>
<p>I have an instance a of class A which has a public method foo() running and 2 other threads - threadB and threadC, all running at the same time.</p>
<p>here's class A</p>
<pre><code>public class A {
int val = 0
public void foo(int incV... | <p>There is absolutely no difference in how the JVM will invoke two methods "in parallel". </p>
<p>In other words: if you want to know what happens when a method is called, you can look <a href="http://stackoverflow.com/questions/20131892/what-happens-after-a-method-is-called-in-java">here</a>.</p>
<p>When a method i... |
Bootstrap nav menu item full width in moblie size not working? <p>I have navbar menu its working fine in all screens except when it turn to mobile its items do not have full width.
[enter image description here][1]</p>
<p>Here is the image: [1]: <a href="http://i.stack.imgur.com/0cvWo.png" rel="nofollow">http://i.stac... | <p>Use <code>navbar-right</code> instead of <code>pull-right</code>.</p>
<p>Try this</p>
<p>HTML:</p>
<pre><code><ul class="nav navbar-nav navbar-right text-center ">
<li><a href="#aboutSec">Me</a><li>
<li><a href="#portfolioSec">Portfolio</a><li>
<... |
Border for background image along with scrolling <p>I am having a contact us form with the following css.</p>
<pre><code>border:30px solid #fff;
background-clip: content-box;
height:100%;
background:url(../Gallery_files/back.png);
background-position: center;
background-repeat:no-repeat;
background-size:cover; ... | <p>That's not the right way to add a border to the <code><body></code> tag. Check <a href="https://css-tricks.com/body-border/" rel="nofollow">this link</a> for some examples to do it. </p>
|
asyncio: prevent task from being cancelled twice <p>Sometimes, my coroutine cleanup code includes some blocking parts (in the <code>asyncio</code> sense, i.e. they may yield).</p>
<p>I try to design them carefully, so they don't block indefinitely. So "by contract", coroutine must never be interrupted once it's inside... | <p>I ended up writing a simple function that provides a stronger shield, so to speak.</p>
<p>Unlike <code>asyncio.shield</code>, which protects the callee, but raises <code>CancelledError</code> in its caller, this function suppresses <code>CancelledError</code> altogether.</p>
<p>The drawback is that this function d... |
R: Color points in PCA based on groups when using autoplot <p>I have produced a PCA plot, where I plot a number of cells based on their expression of various genes. In this plot, I want to color some of the points in a separate color. I tried to achieve this by creading "groups", where I sort the cells based on their e... | <p>How about this?</p>
<pre><code>df$groups <- factor(ifelse(df$gene1 > 0, "Positive", "Others"))
head(df)
gene1 gene2 gene3 gene4 gene5 groups
1 0.5638534 8.968558 94.40170 62.93106 290.442698 Positive
2 0.0000000 15.248374 45.87507 204.21703 291.501669 Others
3 1.9059518 19.488162 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.