Questions Tagged with #Occlusion culling

JavaScript loop through json array?

I am trying to loop through the following json array: { "id": "1", "msg": "hi", "tid": "2013-05-05 23:35", "fromWho": "[email protected]" }, { "id": "2", "msg": "there", "tid": "2013-05-0..

How to correctly represent a whitespace character

I wanted to know how to represent a whitespace character in C#. I found the empty string representation string.Empty. Is there anything like that that represents a whitespace character? I would like ..

How do you create vectors with specific intervals in R?

I have a question about creating vectors. If I do a <- 1:10, "a" has the values 1,2,3,4,5,6,7,8,9,10. My question is how do you create a vector with specific intervals between its elements. For ex..

Install an apk file from command prompt?

I want to install a file using the Windows command line. First I want to build after compiling all the .jar files to create an .apk file for an Android application without using Eclipse. Does anyone ..

Communicating between a fragment and an activity - best practices

This question is mostly to solicit opinions on the best way to handle my app. I have three fragments being handled by one activity. Fragment A has one clickable element the photo and Fragment B has ..

JavaScript: Collision detection

How does collision detection work in JavaScript? I can't use jQuery or gameQuery - already using prototype - so, I'm looking for something very simple. I am not asking for complete solution, just poin..

How can I get the request URL from a Java Filter?

I am trying to write a filter that can retrieve the request URL, but I'm not sure how to do so. Here is what I have so far: import javax.servlet.*; import javax.servlet.http.HttpServletRequest; impo..

Using reflection in Java to create a new instance with the reference variable type set to the new instance class name?

All the examples I look at for reflection show creating a new instance of an unknown implementation, and casting that implementation to it's interface. The issue with this is that now you can't call a..

How do I add a resources folder to my Java project in Eclipse

I want to have a place to store my image files to use in my Java project (a really simple class that just loads an image onto a panel). I have looked everywhere and cannot find how to do this. How do ..

Difference between SRC and HREF

The SRC and HREF attributes are used to include some external entities like an image, a CSS file, a HTML file, any other web page or a JavaScript file. Is there a clear differentiation between SRC an..

Set Response Status Code

I have an API call for which I need to be able to run some checks and potentially return various status codes. I don't need custom views or anything, I just need to return the proper code. If the user..

onchange event for html.dropdownlist

I am trying to trigger an action method for onchange event for dropdownlist, how can I do this without using jquery onchange. @Html.DropDownList("Sortby", new SelectListItem[] ..

how to move elasticsearch data from one server to another

How do I move Elasticsearch data from one server to another? I have server A running Elasticsearch 1.1.1 on one local node with multiple indices. I would like to copy that data to server B running El..

Error when testing on iOS simulator: Couldn't register with the bootstrap server

I was testing my app on the simulator when it crashed on clicking a button of a UIAlertView. I stopped debugging there, made some changes to the code and built the app again. Now when I run the applic..

Creating your own header file in C

Can anyone explain how to create a header file in C with a simple example from beginning to end...

Bash mkdir and subfolders

Why I can't do something like this? mkdir folder/subfolder/ in order to achive this I have to do: mkdir folder cd folder mkdir subfolder Is there a better way to do it?..

How to delete files older than X hours

I'm writing a bash script that needs to delete old files. It's currently implemented using : find $LOCATION -name $REQUIRED_FILES -type f -mtime +1 -delete This will delete of the files older than..

Git: How to return from 'detached HEAD' state

If one would checkout a branch: git checkout 760ac7e from e.g. b9ac70b, how can one go back to the last known head b9ac70b without knowing its SHA1?..

How to get config parameters in Symfony2 Twig Templates

I have a Symfony2 Twig template. I want to output the value of a config parameter in this twig template (a version number). Therefore I defined the config parameter like this: parameters: app.ver..

start/play embedded (iframe) youtube-video on click of an image

I'm trying to start playing an embedded youtube video by clicking an image. The idea is to have an image on top of a video, and when the image is clicked it fades out and starts playing the video. I'..

How to solve npm install throwing fsevents warning on non-MAC OS?

Following warning is being thrown on npm install command - npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\rea ct-scripts\node_modules\fsevents): npm WARN notsup SKIPPING..

Make copy of an array

I have an array a which is constantly being updated. Let's say a = [1,2,3,4,5]. I need to make an exact duplicate copy of a and call it b. If a were to change to [6,7,8,9,10], b should still be [1,2,3..

Find a file by name in Visual Studio Code

How can I find a file by name in Visual Studio Code? A Visual Studio shortcut I'm used to is CTRL+,, but it does not work here...

How can I update a row in a DataTable in VB.NET?

I have the following code: Dim i As Integer = dtResult.Rows.Count For i = 0 To dtResult.Rows.Count Step 1 strVerse = blHelper.Highlight(dtResult.Rows(i).ToString, s) ' syntax error here ..

MatPlotLib: Multiple datasets on the same scatter plot

I want to plot multiple data sets on the same scatter plot: cases = scatter(x[:4], y[:4], s=10, c='b', marker="s") controls = scatter(x[4:], y[4:], s=10, c='r', marker="o") show() The above only s..

extracting days from a numpy.timedelta64 value

I am using pandas/python and I have two date time series s1 and s2, that have been generated using the 'to_datetime' function on a field of the df containing dates/times. When I subtract s1 from s2 ..

How do I connect to a Websphere Datasource with a given JNDI name?

I'm using Websphere Portal 7.0 and creating a portlet with RAD 8.0. My portlet is trying to make a db2 connection to a remote server. I wrote a java program locally to do a basic JDBC connection to th..

How to hide output of subprocess in Python 2.7

I'm using eSpeak on Ubuntu and have a Python 2.7 script that prints and speaks a message: import subprocess text = 'Hello World.' print text['espeak', text]) eSpeak produces the de..

How to set width of a div in percent in JavaScript?

Is it possible to set the height/width of an element in percent using JavaScript or jQuery?..

Gaussian filter in MATLAB

Does the 'gaussian' filter in MATLAB convolve the image with the Gaussian kernel? Also, how do you choose the parameters hsize (size of filter) and sigma? What do you base it on?..

How can I mock an ES6 module import using Jest?

I want to test that one of my ES6 modules calls another ES6 module in a particular way. With Jasmine this is super easy -- The application code: // myModule.js import dependency from './dependency'; ..

Javascript array value is undefined ... how do I test for that

I am trying to test to see whether a Javascript variable is undefined. You will see that I am not expecting the value of predQuery[preId] to be 'undefined' if I don't first get an alert saying "its u..

How can I generate Javadoc comments in Eclipse?

Is there a way to generate Javadoc comments in Eclipse? If so, what is it?..

How to redirect to an external URL in Angular2?

What is the method for redirecting the user to a completely external URL in Angular 2. For example, if I need to redirect the user to an OAuth2 server in order to authenticate, how would I do that? ..

How to conditional format based on multiple specific text in Excel

I have a spreadsheet that i use to determine when/what clients to contact when an issue arises. in the first workbook i insert a column every day and paste in information about any questionable habits..

Table Height 100% inside Div element

Hi I want to set table height 100% to its parent div without define height in div. My code is not working. I dont know what I am missing. Fiddle link <div style="overflow:hidden"> <div style..


What am I missing? This query is returning duplicate data over and over again. The count is correct for a complete total, but I am expecting one row, and yet I am getting the value repeated about 40..

Using 'make' on OS X

I have a MacBook Pro that I'm trying to do some development on. I have a program I want to build, and when I went to use make to build it, I got a "command not found" error. I did some googling and S..

Ruby: kind_of? vs. instance_of? vs. is_a?

What is the difference? When should I use which? Why are there so many of them?..

Is there a way to reset IIS 7.5 to factory settings?

I modified a lot of options in IIS, and would like to reset its settings to default. I already tried installing/reinstalling it. After the reinstall, it still had the site I created. It was still br..

Javascript communication between browser tabs/windows

What's the most reliable way to have Javascript communicate between tabs/windows of the same browser? For example, when Tab 2 starts audio playback, Tab 1 somehow knows about this and can pause it's p..

Resolve conflicts using remote changes when pulling from Git remote

I'm trying to pull code from my GitHub repo onto my server, but the pull keeps failing because of merge conflicts. I don't want to keep any of the changes that may have occurred on my local server sin..

Create an application setup in visual studio 2013

I already have a project which is ready to build. Currently, I am using visual studio 2013. But, I don't know how to create an MSI setup in visual studio 2013, but for visual studio 2010 there are pl..

Where's my JSON data in my incoming Django request?

I'm trying to process incoming JSON/Ajax requests with Django/Python. request.is_ajax() is True on the request, but I have no idea where the payload is with the JSON data. request.POST.dir contains ..

How to set session timeout in web.config

I have tried very hard but cannot find a solution on how to set session timeout value for in-process session for an ASP.Net web application. I am using VSTS 2008 + .Net 3.5 + C#. Here is what I wrote..

Disable a textbox using CSS

How to disable a textbox in CSS? Currently we are having a textbox in our view which can be enabled/disabled depending on a property in the model. We are having MVC view; depending on the valu..

How to start activity in another application?

I have application A defined as below: <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name="com.example.MyExampleActivity" a..

Django DateField default options

I have a model which has a date time field: date = models.DateField(_("Date"), When I check the app in the built in django admin, the DateField also has the time appended to..

Verify External Script Is Loaded

I'm creating a jquery plugin and I want to verify an external script is loaded. This is for an internal web app and I can keep the script name/location consistent(mysscript.js). This is also an ajaxy ..

Simple PHP calculator

I'm creating a basic PHP calculator that lets you enter two values and chose your operator then displays the answer. Everything is working fine except it's not outputting the answer to the browser. H..

Show special characters in Unix while using 'less' Command

I would like to know how to view special characters while using 'less' command. For instance I want to see the non-printable characters with a special notation. For instance in 'vi' editor I use "se..

Check if a radio button is checked jquery

I have this HTML: <input type="radio" name="test" id="test" value="1"><br> <input type="radio" name="test" id="test" value="2"><br> <input type="radio" name="test" id="test..

.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

I have this error when trying to browse php files locally [Fri Apr 13 19:16:40 2012] [alert] [client] C:/AppServ/www/hr-website/.htaccess: Invalid command 'RewriteEngine', perhaps misspelle..

Spring Test & Security: How to mock authentication?

I was trying to figure out how to unit test if my the URLs of my controllers are properly secured. Just in case someone changes things around and accidentally removes security settings. My controlle..

How to validate array in Laravel?

I try to validate array POST in Laravel: $validator = Validator::make($request->all(), [ "name.*" => 'required|distinct|min:3', "amount.*" => 'required|integer|min:1'..

NumPy ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I was calculating eigenvectors and eigenvalues of a matrix in NumPy and just wanted to check the results via assert(). This would throw a ValueError that I don't quite understand, since printing those..

How to know if a DateTime is between a DateRange in C#

I need to know if a Date is between a DateRange. I have three dates: // The date range DateTime startDate; DateTime endDate; DateTime dateToCheck; The easy solution is doing a comparison, but is t..

How to get a string after a specific substring?

How can I get a string after a specific substring? For example, I want to get the string after "world" in my_string="hello python world , I'm a beginner " (which in this case it is..

How to make a radio button unchecked by clicking it?

Unlike check boxes, it is impossible for the user to deselect radio buttons once they are clicked. Is there any way so that they can be toggled programmatically using Javascript? This would be prefe..

Convert NSArray to NSString in Objective-C

I am wondering how to convert an NSArray [@"Apple", @"Pear ", 323, @"Orange"] to a string in Objective-C...

Directory index forbidden by Options directive

I'm using the dompdf plugin for codeigniter: to generate pdfs from a form. This works on localhost, but on the live server I get this in the e..

Show/Hide Multiple Divs with Jquery

I want to use some buttons to show/hide multiple divs using jquery. The page will initially show all divs. The idea then is that there will be a button to reset (show all) and then separate buttons t..

MySQL: ALTER TABLE if column not exists

I have this code: ALTER TABLE `settings` ADD COLUMN `multi_user` TINYINT(1) NOT NULL DEFAULT 1 And I want to alter this table only if this column doesn't exist. I'm trying a lot of different ways,..

'python3' is not recognized as an internal or external command, operable program or batch file

I am using Python 3.5.2 version on Windows 7 and tried using python3 I am getting this error message: 'python3' is not recognized as an internal or external command, operable program or batch ..

java.util.Date format conversion yyyy-mm-dd to mm-dd-yyyy

I have a java.util.Date in the format yyyy-mm-dd. I want it to be in the format mm-dd-yyyy Below is the sample util I tried out for this conversion: // Setting the pattern SimpleDateFormat sm = new Si..

I cannot access tomcat admin console?

I am try to build an app with the integration of JPA and Struts. to do it need to access tomcat manager. But when I access URL http://localhost:8080/manager/html it gives 404 Error to me. My tomcat-..

In PHP, how can I add an object element to an array?

I'm using PHP. I have an array of objects, and would like to add an object to the end of it. $myArray[] = null; //adds an element $myArray[count($myArray) - 1]->name = "my name"; //modifies the el..

Why use ICollection and not IEnumerable or List<T> on many-many/one-many relationships?

I see this a lot in tutorials, with navigation properties as ICollection<T>. Is this a mandatory requirement for Entity Framework? Can I use IEnumerable? What's the main purpose of using IColl..

Connect to Oracle DB using sqlplus

I am using below command in Unix environment to connect to Oracle database: sqlplus test/test@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)( )(PORT=1521)))(CONNECT_DATA=(SID=my..

How can I view the Git history in Visual Studio Code?

I can execute various Git commands from Visual Studio Code, however I couldn't find a way to visualize the history...

Setting href attribute at runtime

What is the best way to set the href attribute of the <a> tag at run time using jQuery? Also, how do you get the value of the href attribute of the <a> tag using jQuery?..

Adding Buttons To Google Sheets and Set value to Cells on clicking

I am new to Google Script. I have a Google Sheet with 5 columns, on each column I need a button (with text 1,2,3,4,5). And on each button click I need to set text of button to corresponding cell a..

Travel/Hotel API's?

I am working on a large project involving creating a worldwide hotel database with rich data such as Addresses, Images, Descriptions, Policies, Coordinates, Facilities, Reviews, Local area description..

Free FTP Library

Can you recommend a free FTP library(class) for C#. The class has to be well written, and have good performance...

AlertDialog.Builder with custom layout and EditText; cannot access view

I am trying to create an alert dialog with an EditText object. I need to set the initial text of the EditText programmatically. Here's what I have. AlertDialog.Builder dialogBuilder = new AlertDialog..

How to generate a random int in C?

Is there a function to generate a random int number in C? Or will I have to use a third party library?..

Fatal error: Call to undefined function mysql_connect()

I have set up PHP, MySQL, and Apache. localhost() for PHP and it is working well. But after I downloaded MySQL, it reports: Fatal error: Call to undefined function mysql_connect() How can I fix ..

How do I get the currently displayed fragment?

I am playing with fragments in Android. I know I can change a fragment by using the following code: FragmentManager fragMgr = getSupportFragmentManager(); FragmentTransaction fragTrans = fragMgr.beg..

Setting paper size in FPDF

i want to seting paper size in fpdf to a half of letter size, it's approximately 8.5x5.5 inc. How can i do that? My fpdf function in php language is $pdf = new FPDF('P','mm','?????'); is..

How to create an array of object literals in a loop?

I need to create an array of object literals like this: var myColumnDefs = [ {key:"label", sortable:true, resizeable:true}, {key:"notes", sortable:true,resizeable:true},...... In a loop lik..

Load local HTML file in a C# WebBrowser

In my app I have a WebBrowser element. I would like to load a local file in it. I have some questions: Where to place the HTML file (so that it will also be installed if a user executes the setup)..

How to clear all <div>s’ contents inside a parent <div>?

I have a div <div id="masterdiv"> which has several child <div>s. Example: <div id="masterdiv"> <div id="childdiv1" /> <div id="childdiv2" /> <div id="childdiv..

Bootstrap trying to load map file. How to disable it? Do I need to do it?

I'm recently playing with bootsrap3. I compiled it from sources and included distr js and css to my project. The thing is, I see in GH dev tools, that it's trying to get .map.css file. Why does it wan..

Get next element in foreach loop

I have a foreach loop and I want to see if there is a next element in the loop so I can compare the current element with the next. How can I do this? I've read about the current and next functions but..

Create a Cumulative Sum Column in MySQL

I have a table that looks like this: id count 1 100 2 50 3 10 I want to add a new column called cumulative_sum, so the table would look like this: id count cumulative_sum 1 100 ..

S3 Static Website Hosting Route All Paths to Index.html

I am using S3 to host a javascript app that will use HTML5 pushStates. The problem is if the user bookmarks any of the URLs, it will not resolve to anything. What I need is the ability to take all url..

Unescape HTML entities in Javascript?

I have some Javascript code that communicates with an XML-RPC backend. The XML-RPC returns strings of the form: <img src='myimage.jpg'> However, when I use the Javascript to insert the string..

Public class is inaccessible due to its protection level

I have the following classes: namespace Bla.Bla { public abstract class ClassA { public virtual void Setup(string thing) { } public abstract bool IsThingVa..

Spring JPA and persistence.xml

I'm trying to set up a Spring JPA Hibernate simple example WAR for deployment to Glassfish. I see some examples use a persistence.xml file, and other examples do not. Some examples use a dataSource, a..

Automatically enter SSH password with script

I need to create a script that automatically inputs a password to OpenSSH ssh client. Let's say I need to SSH into myname@somehost with the password a1234b. I've already tried... #~/bin/ ss..

How to define static constant in a class in swift

I have these definition in my function which work class MyClass { func myFunc() { let testStr = "test" let testStrLen = countElements(testStr) } } But if I move 'testStr' an..

Sending POST data in Android

I'm experienced with PHP, JavaScript and a lot of other scripting languages, but I don't have a lot of experience with Java or Android. I'm looking for a way to send POST data to a PHP script and dis..

How to create a dotted <hr/> tag?

How can I create a dotted or any type of hr line (double, dashed etc.) using CSS? <hr style="...what should I write?..." /> or is there any other trick?..

Copy data from another Workbook through VBA

Guys here's what I want to do and I have a little trouble doing it. I have 1 Workbook where I want to collect data from different files doing something like this. Do While THAT_DIFFERENT_FILE_SOMEWH..

Disable/Enable button in Excel/VBA

I'm trying the following function in VBA/Excel: Sub function_name() button.enabled=false Call Long_Function ' duration: 10sec button.enabled=true End Sub For some reason, this button di..

How do I read / convert an InputStream into a String in Java?

If you have a object, how should you process that object and produce a String? Suppose I have an InputStream that contains text data, and I want to convert it to a String, so fo..

How to create a JSON object

I am trying to create an JSON object out of a PHP array. The array looks like this: $post_data = array('item_type_id' => $item_type, 'string_key' => $string_key, 'string_value' => $s..

How to build a Debian/Ubuntu package from source?

I have the source of a program (taken from cvs/svn/git/...) and I'd like to build a Debian/Ubuntu package for it. The package is present in the repositories, but: It is an older version (lacking fea..

Git submodule update

I'm not clear on what the following means (from the Git submodule update documentation): ...will make the submodules HEAD be detached, unless --rebase or --merge is specified... How does --rebas..

Max tcp/ip connections on Windows Server 2008

I have .Net service that listens on single port over TCP protocol. Clients connect and then transmit data for some time (from few minutes to several hours). Is there any limit on number of connectio..

Pandas count(distinct) equivalent

I am using pandas as a db substitute as I have multiple databases (oracle, mssql, etc) and I am unable to make a sequence of commands to a SQL equivalent. I have a table loaded in a DataFrame with so..

Unable to create Genymotion Virtual Device

I have successfully downloaded and installed Genymotion and Virtualbox as well as a Virtual Device Image but I am unable to create a virtual device.I get an error message stating Unable to create..

Getting full JS autocompletion under Sublime Text

I just installed the Sublime Text under Windows Vista, and even following the advice given in this post, namely to explicitly set View > Syntax > JavaScript > JavaScript, I only see suggestio..

Having both a Created and Last Updated timestamp columns in MySQL 4.0

I have the following table schema; CREATE TABLE `db1`.`sms_queue` ( `Id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `Message` VARCHAR(160) NOT NULL DEFAULT 'Unknown Message Error', `CurrentState..

Check if element is visible in DOM

Is there any way that I can check if an element is visible in pure JS (no jQuery) ? So, for example, in this page: Performance Bikes, if you hover over Deals (on the top menu), a window of deals appe..

What is the parameter "next" used for in Express?

Suppose you have a simple block of code like this: app.get('/', function(req, res){ res.send('Hello World'); }); This function has two parameters, req and res, which represent the request and r..

ORA-00060: deadlock detected while waiting for resource

I have a series of scripts running in parallel as a nohup on an AIX server hosting oracle 10g. These scripts are written by somebody else and are meant to be executed concurrently. All the scripts are..

Ruby class instance variable vs. class variable

I read "" but I'm of two minds when to use class instance variables. Class variables are shared by all objec..

How do I install imagemagick with homebrew?

I'm trying to install Imagemagick on OSX Lion but something is not working as expected. -> brew install imagemagick /usr/local/git/bin/git ==> Cloning ..

How to move certain commits to be based on another branch in git?

The situation: master is at X quickfix1 is at X + 2 commits Such that: o-o-X (master HEAD) \ q1a--q1b (quickfix1 HEAD) Then I started working on quickfix2, but by accident took quick..

What is the difference between Modal and Push segue in Storyboards?

Can someone explain to me what is the exact difference between modal and push segue? I know that when we use push the segue gets added to a stack, so when we keep using push it keeps occupying memory..

SQL How to correctly set a date variable value and use it?

I have the following query which uses a date variable, which is generated inside the stored procedure: DECLARE @sp_Date DATETIME SET @sp_Date = DateAdd(m, -6, GETDATE()) SELECT DISTINCT pat.Publicati..

Visual Studio 2010 always thinks project is out of date, but nothing has changed

I have a very similar problem as described here. I also upgraded a mixed solution of C++/CLI and C# projects from Visual Studio 2008 to Visual Studio 2010. And now in Visual ..

Checking during array iteration, if the current element is the last element

Please help me to translate this pseudo-code to real php code: foreach ($arr as $k => $v) if ( THIS IS NOT THE LAST ELEMENT IN THE ARRAY) doSomething(); Edit: the array may have num..

JSON and XML comparison

I want to know which is faster: XML and JSON? When to use which one ?..

How to loop through an associative array and get the key?

My associative array: $arr = array( 1 => "Value1", 2 => "Value2", 10 => "Value10" ); Using the following code, $v is filled with $arr's values foreach($arr as $v){ echo($v)..

Python: finding an element in a list

What is a good way to find the index of an element in a list in Python? Note that the list may not be sorted. Is there a way to specify what comparison operator to use?..

Return Bit Value as 1/0 and NOT True/False in SQL Server

I have a Table in SQL Server 2000 with BitValue Column. But, it is being displayed as True/False in SQL Server Management Studio. When I do a Select * from Tablename it returns the BitValue Column val..

Access non-numeric Object properties by index?

If I have an array like this: var arr = ['one','two','three']; I can access different parts by doing this: console.log(arr[1]); How can I access object properties by their order rather than by k..

expected assignment or function call: no-unused-expressions ReactJS

class Game extends Component { constructor() { super() this.state = { speed: 0 } //firebaseInit() } render() { return ( <div> <h1>T..

failed to load ad : 3

I'm setting an ad to my Android application using DoubleClick and can't manage to show the final ad, can someone help me? When I test an ad by adding ".addTestDevice("xxx...")" I g..

How to select <td> of the <table> with javascript?

I know this is very easy question, but I couldn't find the answer anywhere. Only answers are the ones using jQuery, not pure JS. I've tried the code below and it doesn't work. I don't know why. var ..

How to Call Controller Actions using JQuery in ASP.NET MVC

I've been reading on this for a while and found that you can call a controller action by using: $.ajax("MyController/MyAction", function(data) { alert(data); }); Does this mean I should add the..

Get contentEditable caret index position

I'm finding tons of good, crossbrowser anwers on how to SET the cursor or caret index position in a contentEditable element, but none on how to GET or find its index... What I want to do is know the ..

Why would you use String.Equals over ==?

I recently was introduced to a large codebase and noticed all string comparisons are done using String.Equals() instead of == What's the reason for this, do you think?..

How to get POST data in WebAPI?

I'm sending a request to server in the following form: http://localhost:12345/api/controller/par1/par2 The request is correctly resolved to a method like: [HttpPost] public void object Post(string..

Negative regex for Perl string pattern match

I have this regex: if($string =~ m/^(Clinton|[^Bush]|Reagan)/i) {print "$string\n"}; I want to match with Clinton and Reagan, but not Bush. It's not working...

Difference between Key, Primary Key, Unique Key and Index in MySQL

When should I use KEY, PRIMARY KEY, UNIQUE KEY and INDEX?..

How to disable input conditionally in vue.js

I have an input: <input type="text" id="name" class="form-control" name="name" v-model="" :disabled="validated ? '' : disabled"> and in my Vue.js component, I have: .. .. ready() {..

Passing an array by reference

How does passing a statically allocated array by reference work? void foo(int (&myArray)[100]) { } int main() { int a[100]; foo(a); } Does (&myArray)[100] have any meaning or its j..

VBA: Selecting range by variables

I want to select the formatted range of an Excel sheet. To define the last and first row I use the following functions: lastColumn = ActiveSheet.UsedRange.Column - 1 + ActiveSheet.UsedRange.Columns.C..

Remove lines that contain certain string

I'm trying to read a text from a text file, read lines, delete lines that contain specific string (in this case 'bad' and 'naughty'). The code I wrote goes like this: infile = file('./oldfile.txt') ..

How to set a Timer in Java?

How to set a Timer, say for 2 minutes, to try to connect to a Database then throw exception if there is any issue in connection?..

Monitoring the Full Disclosure mailinglist

I develop web applications, which use a number of third party applications/code/services. As part of the job, we regularly check with the Full Disclosure mailing list

How to force uninstallation of windows service

I installed a windows service using installUtil.exe. After updating the code I used installUtil.exe again to install the service w/o uninstalling the original version first. When I now try to unins..

Working with UTF-8 encoding in Python source

Consider: $ cat u = unicode('d…') s = u.encode('utf-8') print s $ python File "", line 1 SyntaxError: Non-ASCII character '\xe2' in file on line 1, but no encoding de..

How do you reverse a string in place in C or C++?

How do you reverse a string in C or C++ without requiring a separate buffer to hold the reversed string?..

What's the best way to get the last element of an array without deleting it?

Ok, I know all about array_pop(), but that deletes the last element. What's the best way to get the last element of an array without deleting it? EDIT: Here's a bonus: $array = array('a' => 'a'..

How do I check if a property exists on a dynamic anonymous type in c#?

I have an anonymous type object that I receive as a dynamic from a method I would like to check in a property exists on that object. .... var settings = new { Filename="temp.txt", ..

Should I make HTML Anchors with 'name' or 'id'?

When one wants to refer to some part of a webpage with the "" method, should one use <h1><a name="foo"/>Foo Title</h1> or <h1 id="foo">Foo Title</..

How can I fill out a Python string with spaces?

I want to fill out a string with spaces. I know that the following works for zero's: >>> print "'%06d'"%4 '000004' But what should I do when I want this?: 'hi ' of course I can meas..

T-SQL loop over query results

I run a query select from table and I need to loop over the results so I can exec a store procedure for each row exec stored_proc @varName=@id,@otherVarName='test' How can I do this in a..

What difference is there between WebClient and HTTPWebRequest classes in .NET?

What difference is there between the WebClient and the HttpWebRequest classes in .NET? They both do very similar things. In fact, why weren't they merged into one class (too many methods/variables etc..

MVC If statement in View

I have problem with IF statement inside MVC View. I am trying to use it for creating row for every three items. <div class="content"> <div class="container"> @if (ViewBag.Articles !..

Redirecting 404 error with .htaccess via 301 for SEO etc

I couldn't find a straight answer to my question and need to know it from the real experts. I had a website which urls were generated by Joomla. I believe that tons of urls are around in the search e..

Simple example of threading in C++

Can someone post a simple example of starting two (Object Oriented) threads in C++. I'm looking for actual C++ thread objects that I can extend run methods on (or something similar) as opposed to ca..

How can I create C header files

I want to be able to create a collection of functions in a header file that I could #include in one of my C Programs...

tkinter: how to use after method

Hey I am new to python and am using tkinter for my gui. I am having trouble using the "after" method. The goal is to make a random letter appear every 5 seconds. Here is my code: import random impor..

if arguments is equal to this string, define a variable like this string

I am doing some bash script and now I got one variable call source and one array called samples, like this: source='country' samples=(US Canada Mexico...) as I want to expand the number of sources ..

How to print like printf in Python3?

In Python 2 I used: print "a=%d,b=%d" % (f(x,n),g(x,n)) I've tried: print("a=%d,b=%d") % (f(x,n),g(x,n)) ..

How can I easily convert DataReader to List<T>?

I have data in a DataReader which I want to be converted to a List<T>. What is a possible simple solution for this? For e.g. in CustomerEntity class, I have CustomerId and CustomerName properti..

jQuery: Clearing Form Inputs

I have tried to different ways to clear a form: <form action="service.php" id="addRunner" name="addRunner" method="post"> First Name: <input type="text" name="txtFirstName" id="txtFirstName"..

Assign a class name to <img> tag instead of write it in css file?

I am curious to know, is it true that it is better to assign a class name to the <img> tag in the html file instead of writing it down directly into css file? <div class="column"> <..

E: Unable to locate package mongodb-org

I am trying to download mongodb and I am following the steps on this link. But when I get to the step: sudo apt-get install -y mongodb-org I get the following error: Reading package lists... Done..

Angular - ui-router get previous state

Is there a way to get the previous state of the current state? For example I would like to know what the previous state was before current state B (where previous state would have been state A). I..

jQuery Keypress Arrow Keys

I'm attempting to capture arrow key presses in jQuery, but no events are being triggered. $(function(){ $('html').keypress(function(e){ console.log(e); }); }); This generates events..

Where do I call the BatchNormalization function in Keras?

If I want to use the BatchNormalization function in Keras, then do I need to call it once only at the beginning? I read this documentation for it: I don't see w..

How to access data/data folder in Android device?

I am developing an app and I know my database *.db will appear in data/data/com.****.*** I can access this file from AVD in Eclipse with help of sqlite manager But I can't access this file in my Andro..

The target ... overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig

I have incorporate SpatialIite into a Xcode project which uses a header file from Proj.4, just one header. Both are Xcode projects and have static targets. I'm trying to migrate from git submodule to..

Command to remove all npm modules globally?

Is there a command to remove all global npm modules? If not, what do you suggest?..

What is Android keystore file, and what is it used for?

This is a general question, but particularly I am interested in it's use for Android. What is a keystore file, and what is it used for? Can multiple Android applications use the same keystore to sign..

Batch script to find and replace a string in text file within a minute for files up to 12 MB

I have written a batch script to replace a string in text file. Following is the script. @echo off &setlocal set "search=%1" set "replace=%2" set "textfile=Input.txt" set "newfile=Output.txt" (f..

referenced before assignment error in python

In Python I'm getting the following error: UnboundLocalError: local variable 'total' referenced before assignment At the start of the file (before the function where the error comes from), I declar..

Is there a way to automatically generate getters and setters in Eclipse?

I am working on a new Android project (Java), and created an Object with a large number of variables. Since I am planning to add getters and setters for all of them, I was wondering: is there a shortc..

VB.NET - Remove a characters from a String

I have this string: Dim stringToCleanUp As String = "bon;jour" Dim characterToRemove As String = ";" I want a function who removes the ';' character like this: Function RemoveCharacter(ByVal strin..

Adding files to java classpath at runtime

Is it possible to add a file (not necessarily a jar file) to java classpath at runtime. Specifically, the file already is present in the classpath, what I want is whether I can add a modified copy of ..

Is there a vr (vertical rule) in html?

I know there is a hr (horizontal rule) in html, but I don't believe there is a vr (vertical rule). Am I wrong and if not, why isn't there a vertical rule?..

Celery Received unregistered task of type (run example)

I'm trying to run example from Celery documentation. I run: celeryd --loglevel=INFO /usr/local/lib/python2.7/dist-packages/celery/loaders/ NotConfigured: No 'celeryconfig' module found..

How to check if a column is empty or null using SQL query select statement?

How do I check if a column is empty or null using a SQL select statement? For instance, if I want to check: select * from UserProfile WHERE PropertydefinitionID in (40, 53) and PropertyValue is null..

How to redirect to another page using AngularJS?

I am using ajax call to perform functionality in a service file and if the response is successful, I want to redirect the page to another url. Currently, I am doing this by plain JS code window.locati..

maximum value of int

Is there any code to find the maximum value of integer (accordingly to the compiler) in C/C++ like Integer.MaxValue function in java?..

How to Add a Dotted Underline Beneath HTML Text

How do you underline html text so that the line beneath the text is dotted rather than the standard underline? Preferably, I would like to do this without using a separate CSS file. I'm a novice at ht..

Is it possible to forward-declare a function in Python?

Is it possible to forward-declare a function in Python? I want to sort a list using my own cmp function before it is declared. print "\n".join([str(bla) for bla in sorted(mylist, cmp = cmp_configs..

Difference between ref and out parameters in .NET

What is the difference between ref and out parameters in .NET? What are the situations where one can be more useful than the other? What would be a code snippet where one can be used and another can't..

Embed Google Map code in HTML with marker

I have several places with their latitude and longitude. I want to display them in google map. Thats ok, what i can't is to display the marker at the specific lat,long position. e.g. if i've the foll..

Connect to external server by using phpMyAdmin

I have phpMyAdmin installed on my local machine. How can I make it connect to an external server?..

Removing an element from an Array (Java)

Is there any fast (and nice looking) way to remove an element from an array in Java?..

"NODE_ENV" is not recognized as an internal or external command, operable command or batch file

I'm trying to setup an environment for a Node.js app. but I'm getting this error every time. "NODE_ENV" is not recognized as an internal or external command, operable command or batch file. W..

How do I remove a CLOSE_WAIT socket connection

I have written a small program that interacts with a server on a specific port. The program works fine, but: Once the program terminated unexpectedly, and ever since that socket connection is shown i..

How to load assemblies in PowerShell?

The following PowerShell code #Get a server object which corresponds to the default instance $srv = New-Object -TypeName Microsoft.SqlServer.Management.SMO.Server ... rest of the script ... Gives t..

How to declare a variable in a PostgreSQL query

How do I declare a variable for use in a PostgreSQL 8.3 query? In MS SQL Server I can do this: DECLARE @myvar INT SET @myvar = 5 SELECT * FROM somewhere WHERE something = @myvar How do I do the s..

How to use relative paths without including the context root name?

To working my static file (CSS, JS) I have to write absolute path like /AppName/templates/style/main.css. Is there any solution, that I could write relative path like style/main.css?..

Is iterating ConcurrentHashMap values thread safe?

In javadoc for ConcurrentHashMap is the following: Retrieval operations (including get) generally do not block, so may overlap with update operations (including put and remove). Retrievals reflect..

How to create unit tests easily in eclipse

I want to create unit tests easily by just selecting method. Is there a tool in eclipse that does that. It should support templates. I should be able to create positive test as well as negative tests...

How to clear mysql screen console in windows?

The title is my question. I googled and try something like mysql> !\ clear mysql> !\ cls mysql> system cls mysql> system clear blah blah ... but none of them works. anyone show me how..

Conversion from 12 hours time to 24 hours time in java

In my app, I have a requirement to format 12 hours time to 24 hours time. What is the method I have to use? For example, time like 10:30 AM. How can I convert to 24 hours time in java?..

Include PHP inside JavaScript (.js) files

I have a JavaScript file (extension .js, not .html) containing several JavaScript functions. I want to call one of the PHP functions in a PHP file containing only several PHP functions from within on..

Get checkbox values using checkbox name using jquery

I have several input checkboxes, (they name is same for send array on server). So, I need get each value this checkboxes and I want use as selector checkbox names, this not works, help please. <f..

What is the correct target for the JAVA_HOME environment variable for a Linux OpenJDK Debian-based distribution?

In Windows, JAVA_HOME must point to the JDK installation folder (so that JAVA_HOME/bin contains all executables and JAVA_HOME/libs contains all default jar libraries). If I download Sun's JDK bundle ..

Working copy locked error in tortoise svn while committing

I'm using Tortoise SVN to update and commit changes to the repository in the server whenever I make changes to my working copy. But from a few days I'm not able to commit the changes and I get the fol..

Easiest way to convert a Blob into a byte array

what is the easiest way to convert a Blob into a byte array?I am using MYSQL and i want to convert a Blob datatype into a byte array. Iam using java programming language:)..

Using variable in SQL LIKE statement

I've got a sproc (MSSQL 2k5) that will take a variable for a LIKE claus like so: DECLARE @SearchLetter2 char(1) SET @SearchLetter = 't' SET @SearchLetter2 = @SearchLetter + '%' SELECT * FROM Bran..

jQuery How to Get Element's Margin and Padding?

Just wondering - how using jQuery - I can get an elements formatted total padding and margin etc ? i.e. 30px 30px 30px 30px or 30px 5px 15px 30px etc I tried var margT = jQuery('img').css('margin')..

What is Dependency Injection?

Possible Duplicate: What is dependency injection? Spring is the framework from where the concept Dependency Injection came to picture. What is purpose of DI ? How does it benefit ? How is ..

MySQL load NULL values from CSV data

I have a file that can contain from 3 to 4 columns of numerical values which are separated by comma. Empty fields are defined with the exception when they are at the end of the row: 1,2,3,4,5 1,2,3,,..

How do I convert a number to a letter in Java?

Is there a nicer way of converting a number to its alphabetic equivalent than this? private String getCharForNumber(int i) { char[] alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray(); if (..

What is the difference between __str__ and __repr__?

What is the difference between __str__ and __repr__ in Python?..

How to convert String to Date value in SAS?

I want to convert a String to Date in SAS, I tried: data _null_; monyy = '05May2013'; date = input(substr(strip(monyy),1,9),yymmdd.);; put date=date9.; run; But it did not work. Can..

opening a window form from another form programmatically

I am making a Windows Forms application. I have a form. I want to open a new form at run time from the original form on a button click. And then close this new form (after 2,3 sec) programatically but..


I have reached the end of my rope with CMake; it has so much potential, but I cannot seem to make it find the basic system tools (i.e. make) in order to function. SYMPTOMS CMake and the CMake GUI pr..