FAQ Database Discussion Community


Are there still coroutines in Python 3?

python-3.x,yield,coroutine
There is a detailed explanation of coroutines in Python 2 here http://www.dabeaz.com/coroutines/. However, searching Python 3 official documentation for keywords "coroutine" and "(yield)" I find only asyncio.coroutines which are specific to asyncio module and they use "yield from" syntax.

Python: Plotting blocks on a polar grid (Basemap.pcolormesh)

python,basemap
I want to plot blocks of color on a polar grid. Currently (as seen below) the blocks do not follow the specified meridians and parallels. I would like these blocks to fit within the arched boxes I have drawn. Any help would be grately appreciated. import numpy as np import...

Substring strange Bounds?

java,string,substring,indexoutofboundsexception
So, I am trying to figure out why String.substring(int startIndex) allows a start index that is out of bounds and does not throw OOB exception? Here is the code I was testing this with : public class testSub { public static void main(String[] args) { String testString = "D"; String...

Assuming several variables in Maple

maple
I trying to make a constraints for the variables in Maple 17. But it works unpredictably. As you can see there are no constraints for the variables N and r. So what is a problem? assume(m::integer, m > 0); assume(N::integer, N > 0); assume(r::integer, r > 0, r >= m,...

Getting error related to NSDictionary object type

ios,objective-c,nsarray,nsdictionary,nspredicate
I want to filter list of countries based on either Country name or Country ISD code. For example, if user types '9', India should be added to filtered array because ISD code of India is "+91". My datasource contains all the information like country name, ISD code etc.. Here is...

Unable to read value with RegistrySearch

wix,windows-installer,installer,msiexec
My installer need to distinguish between Intel and AMD processor manifacturer, in order to drop the corresponding components (Drivers). I've seen that is possible to catch such information from a registry key. I've done the following <Property Id="REGMANIFACTURER"> <RegistrySearch Id="RegCPU" Root="HKLM" Key="HARDWARE\DESCRIPTION\System\ControlProcessor\0" Name="VendorIdentifier" Type="raw" Win64="yes" > </RegistrySearch> And after drop...

Decimal value delimiter issue

c#,sql-server-2008,.net-2.0
Not sure how to describe the issue in the title. I'm saving a price (decimal only, not currency format) to a SQL db. On Windows 8 computers, if there is a decimal value, the value will move to the left, and become a .00 decimal. For example: 120.34 will become...

calculate consecute streak in excel row

excel,excel-formula,excel-2010,excel-2007
I am trying to calculate 2 values. Current Streak and Long Streak. each record is on 1 row and contains a name and values each of those columns has a value from 1 to 200. Example: John Doe 14 16 25 18 40 65 101 85 14 19 18 9...

ArrayIndexOutOfBoundsException in MapReduce

hadoop,mapreduce,file-read
I am getting array index out of bound error in MAP part. My code is as below. I am trying to read the input file from the HDFS. Is there any better way to read the HDFS file? public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, Text> {...

DateFormatString to DateTime Format at GridView did not changed

asp.net,datetime,gridview
I have to change string at gridview's column to datetime format. I've research and found it using DataFormatString property at BoundField and set false in HtmlEncode. But the value didn't changed to DateTime Format. this is the code: <asp:gridview ID="GridView" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%" AllowPaging="True" PageSize="5"> <Columns> <asp:BoundField...

Gmail console App C#

c#,console
I'm trying to figure out why I am getting the error "Cannot assign to 'loggedIn' because it is a method group" within my menu method. Any help will be appreciated. Code is below: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GmailClient { class Program { static string userName="";...

site not looking responsive after changing the responsive theme

magento,responsive-design,responsive-slides
We bought new magento theme and edited the theme. After we removed some static blocks, we changed image sizes and some colors. Finally we checked the site, and it's not as responsive compared to the original theme. Is the change in image size the problem for not responsive or code...

How to pull mysql database from heroku to local machine

mysql,ruby-on-rails,ruby,heroku
Hi I have a ruby on rails app hosted on heroku and it is using mysql as database. Now I have to take backup of the database to my local machine. But I am getting issues while taking backup. For this I installed taps gem and I am using following...

How to make 2 way `up` and `down` td text `sort`

jquery,sorting
I am trying to make a sort function, it works. But i would like to put the sort vise-versa (up and down) 2 way approach. at present i am getting one way sort works, when user click back i would like to sort by opposite direction. still i have added...

How to deal with database pagination when a row in between can be deleted by user action?

java,mysql,hibernate,pagination
I am stuck in a situation. I hope I get a solution here. I am using paging to show some data on user profile page. Using a basic paging to do so: public Page list(Query query, int pageNo, int perPage) { int totalResults = query.list().size(); int firstResult = (pageNo -...

Not able to set the value in RadNumeric Text box in OnBlur event

jquery,asp.net,telerik,radtextbox,telerik-ajax
My requirement is - when user enter any number in the text box & tabout - i need to add leading zero's in the text box value. function AddPaddingToInvestmentNumber(sender, args) { var textBoxVar = "<%=txt1.ClientID %>"; var fValue = $find (textBoxVar).get_value(); var resultset = FormatInvNumber(fValue, 5); $find(textBoxVar).set_value(resultset); } function FormatInvNumber(num,...

Google Maps Cannot Remove Marker Using Timer

java,android,google-maps
I have a problem with update current markers on Google Maps. These markers are created when the activity starts. I save all merkers into a arraylist. Then I set a timer to redraw those markers every 10 seconds. However System gives me this error: 02-26 15:33:53.295: E/AndroidRuntime(21337): java.lang.IllegalStateException: Not on...

How to Compare values in SQL having dots

sql
I'm comparing values from two different database. In one table the name is stored with dots(i.e A.B C) and in another table the same value is stored as AB C(i.e in second table none of the names contain dots) In SQL how can I compare the values? Dot can come...

Writing Data Into CSV Format File

python,mongodb,csv,pymongo,export-to-csv
I'm trying to write some data into CSV format using fetched data from MongoDB, with Mongopy. Currently, the headers are currently set, and the problem is that the actual data is not being inserted into the CSV file. here is the code snippet : from pymongo import MongoClient import csv...

Top 5 and Bottom 5 records in Power Pivot

powerpivot,dax,powerview,calculated-measure
I am trying to show top 5 records and bottom 5 records in two separate tables in Power View. I have created a calculated measure to show the records. But it doesnt giving me the required result. My Data Set is:- ID Name Rating OverallRating Ranking 1 A 124 2...

std::unique_ptr as out argument to a function

c++11,unique-ptr
struct cls{ ~cls(){std::cout<<"dtor\n";} }; void foo(cls** pp){ *pp = new cls; } int main() { cls* raw_ptr = 0; foo(&raw_ptr); std::unique_ptr<cls> u_ptr{raw_ptr}; } Is there any way to directly access the raw_pointer in the unique_ptr to pass to the function foo(cls** pp)? Or cls* raw_ptr = 0; foo(&raw_ptr); std::unique_ptr<cls> u_ptr{raw_ptr};...

IE 11. Why have I click and dblclick events after reload page if I double click a submit button

internet-explorer-11,double-click
I have a simple html page and event handlers on submit button and form. Event handler function print to console what is event appers. <html> <head> <script type="text/javascript" src="../js/jquery-2.1.1.js"></script> </head> <body> <form id="formId" method="post"> <input id="inpSbm" name="inpSbm" type="submit" value="SubmitTest" class="lockDoubleClick"/> </form> </body> <script> $(document).ready(function () { console.log("on ready"); $(".lockDoubleClick").each(function ()...

price not showing on front end virtuemart

php,mysql,joomla3.0,virtuemart
I have upgrade joomla and virtuemart afer upfrading joomla and virtuemart 3.0.6 price is not showing on front end, i do not know what going wrong with my code and my virtuemart configurations . i have paste my code here for showing price. if ($this->show_prices == '1') { if ($product->prices['salesPrice']<=0...

Why print in Python doesn't pause when using sleep in a loop?

python,python-3.x
This code: import time for i in range(10): print(i) time.sleep(.5) Causes my computer to hang for 5 seconds, and then print out 0-9, as opposed to printing a digit every half second. Am I doing something wrong?...

Android: Not able to change image in Window Title

android,android-imageview
I have a parent activity (from which all other activities extend) - with a 'Navigation Drawer Toggle' icon in window title. I want to change the 'Navigation Drawer Toggle' image everytime drawer icon is clicked ( to open/close drawer) public class ParentActivity extends Activity { private ImageView imgDrawer; @Override protected...

What is a Locale String?

javascript,arrays,string
I've been looking through A re-introduction to javascript and came across the array method toLocaleString(). I did some googling (something to do with localization?) but am having difficulty figuring it out. What is a locale? What's the difference between toString() and toLocaleString() in javascript?...

Can URL Scheme Launch Same App?

ios,objective-c,url-scheme
I want to launch my App once it goes to background. I have used following code: NSString *customURL = @"TestApp://?caller=TestApp%3A%2F%2Fblabla"; if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:customURL]]) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]]; } else { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"URL error" message:[NSString stringWithFormat: @"No custom URL defined for %@", customURL] delegate:self...

KVO with shared NSUserDefaults in Swift

swift,ios7,ios8
I am having issues communicating between my host app and its extensions through communicating NSUserDefaults changes. I initialized NSUserDefaults using init(suiteName:), added KVO observer using the addObserver(...) method and overrided the method observeValueForKeyPath(...) but the method observeValueForKeyPath(...) is not called when I change the value corresponding to the observing key....

Saving Custom Stylesheets for Any Website

css,google-chrome,customization,stylesheet,google-chrome-devtools
I know how to live-edit and save stylesheets for my own sites that I am developing locally. But wouldn't it be nice to be able to save your own custom styles for any website on the web? For example, I use a very cool, free chat system called tawk.to but...

System.currentTimeMillis() not displaying time in UTC , instead displaying current timezone time

java
I have a requirement of getting UTC time , hence in many places iam using below code for calcualting utc time. System.currentTimeMillis() ; Iam in IST - (GMT+5:30) , System.currentTimeMillis() - should display UTC time (IST-5:30) , instead it is taking current time (GMT+5:30). I donot want to use the...

Multiple row count from single table

sql,select,db2
How do I get counts of multiple records from a single table using db2 query? Suppose I want to get the count of 1 record am using: select count(*) from schema.table where record value='x' What I need is a count of multiple records from the same table in separate rows...

Background colour expression brings up a surprising result

reporting-services,ssrs-2008-r2
I have a report where I want a cell colour to change if a duplicate value appears. I have used this expression for Background Colour: IIF(Previous(Fields!CustomerSurname.Value) = Fields!CustomerSurname.Value, "Red", Fields!CustomerSurname.Value) This works fine but if the customer surname is 'Brown' or 'Grey' then the cell colour matches the colour of...

python tkinter reference in comboboxes created in for loop

python,for-loop,combobox,reference,tkinter
My code so far, i want to import images depending on combobox and selection. I need reference to self.box. e.g. self.box1, self.box2 etc or append them somewhere somehow from loop if possible from Tkinter import * import ttk class Application(Frame): def __init__(self, master): Frame.__init__(self, master, relief="sunken", border=1) self.master = master...

searchable drop down list with each options are like table rows

jquery,html
I want to create a dropdown list with each options are like table rows (it should looks like the following image). I don't interested in creating my own control, because it takes lot of time. Any idea guys ? Please give me some links....

How to extend the following API function in java and not lead to ambiguous

java,api,overloading
I have some existing overloading API: 1). foo(a, b) { return foo(a, b, null); } 2). foo(a, b, c) {return foo(a,b,c,null);} 3). foo(a, b, c, d) { implement of the function...; } Where a, b, c are some data structure the value of which can be null as well. now...

Android Studio passing JSON array and object

java,android,arrays,json
This is what the JSON looks like: [{ "pmid": "2", "name": " MANAGEMENT", "result": "1", "properties": [ { "prop_id": "32", "prop_name": "Bonneville", "address": "122 Lakeshore", "city": "Ripley", "state": "OH", "zip": "11454", "lat": "41.123", "long": "-85.5034" } ] }] I am trying to parse it with the following Java in Android...

Undefined funtion link_to in laravel 5

laravel,laravel-5,php-5.2
I was trying to create a view in laravel 5, I used the function link_to to create some html link but to my dismay; I got an error as below FatalErrorException Call to undefined function link_to() Was this function removed ? I know the alternative is to write the actual...

Split values into separate rows

sql,sql-server,split
WITH Numbers AS (SELECT Table.ProductNumber FROM Table WITH (NOLOCK)) returns ProductNumber like 1, 2, 3,4,5 - some are comma separated, so I want to split and than do proper SELECT on them with WHERE What I got so far is: SELECT @XML = CONVERT(xml,'<root><s>' + REPLACE(Numbers , ',' ,'</s><s>') +...

semantic-ui sortable table not getting sorted

jquery,frontend,semantic-ui
I am using semantic-ui 1.8.1 I created a sortable table as documented at http://semantic-ui.com/collections/table.html#sortable The table however does not get sorted when i click on the table column headers. I have included the file I was able to reproduce this on jsfiddle also. The link is http://jsfiddle.net/4woemsjt/5/ This despite that...

Find all words/string in an expression

php,regex,preg-match
Lets say I have expression like $string = ( score + total-score - total-min_score) / papoy I want to able to extract those ALL words/term into an array ( words with/without dash and underscore ) I tried like (I'm not so good with regex) preg_match("(\w+-_)",$string,$matches); But it only return me...

Stopping debugger at an optimized out line of code

c++,gcc,gdb
If I want to stop in an empty block of code it's always a problem. if (...) { // I want the debugger to stop here! } If I add an arbitrary line of code which does not affect program behaviour it is likely to be optimized out, depending on...

Is it safe to access a variable declared in an inner scope by pointer?

c,pointers,scope
The program below prints root 3 next 11 However, I am not sure if the program keeps root.next until the end of the program. #include<stdio.h> typedef struct sequence { int x; sequence* next; }sequence; int main() { sequence root; root.x = 3; { sequence p; p.x = 11; root.next =...

MySQL said: Error #1064 - while using IF condition in sql

mysql,sql,database
I got this error msg in my sql command. i am unable to figure out the cause. please help me. if ( SELECT * FROM `teams` WHERE `client_id`='3' and `member_id`='6' and `current`='1' ) then begin UPDATE `teams` SET `current`='0' WHERE `client_id`='3' and `member_id`='6' and `current`='1' end ; else begin INSERT...

Why Swing components should be accessed on the Event Dispatch Thread only? [closed]

java,multithreading,swing,concurrency,event-dispatch-thread
The above statement is mentioned in the SwingWorker javadoc. In an application I have seen a lengthy background task runs in a distinct thread and updates the UI as well without a problem (a reference to a Swing component was accessible). Could it be that something bad can happen?...

how do you access the values in a couchbase view?

view,go,couchbase
I have a widget.json file which is loaded into a document in couchbase: { "type": "widget", "name": "clicker", "description": "clicks!" } I also have a couchbase design document, couchbase.ddoc, for a bucket. It is registered with the name "views": { "_id": "_design/accesscheck", "language": "javascript", "views": { "all_widgets": { "map": "function(doc,...

how to add inbound rules for AWS EC2 security group for all traffic

amazon-web-services,amazon-ec2,boto
i am trying to add inbound rules for AWS EC2 security group for all traffic. i am using python boto module to do so. i already did add rules for tcp|udp|icmp protocol. But cant add rules for all traffic. how should i do it?...

Get nested element by tag->id->element with javascript

javascript,html
document.getElement(div#menuArea).getElements(a) I want to get all the a elements from a div with id "menuArea". I think above syntax is wrong. Can anyone point me in the right direction?...

Bluebird Promise serial iteration, and resolve to modified array?

javascript,node.js,promise,bluebird
I have this promise that creates a new Item document if it's not found in the db, and then stores it in a previously created Collection document.. The Collection document is the first string in an array, and any subsequent index in the array translates to one or more Item...

In `ListView`, Why does disabling `animationCache` and `scrollingCache` reduces scroll lag?

android,performance
I have tried to get more information about the methods in the documentation, but I couldn't find any useful information related to my question. It seems counter-intuitive that the enabling caching would introduce lag - the purpose of caching is to reduce retrieval latency after all. So what exactly is...

How to play embedded youtube video in webview android with a button

android,webview,youtube
In android code with layout file I have a button, by clicking on that button I want to play YouTube video in the web-view. Any Idea

Mongocsharpdriver not working with ASP:NET Core 5.0 (vNext)?

c#,mongodb,asp.net-5
So I'm getting my feet wet with ASP.NET 5.0, and want to start off using MongoDB. I've done this in several projects, just not in vNext before. I add the "mongocsharpdriver" to the project.json and everything seems fine, but when I compile, I get a bunch of errors about mongo...

How to alert the user using Toast that the OkHttp request returned something other than 200?

android,okhttp,android-toast
I'm using OkHttp and everything is working fine, however, I wanted to take into consideration the case where the DNS resolution is off, the server is down, slow, or simply returns something other than HTTP Status Code 200. I've tried to use Toast, but I can't since this is done...

$_POST request in PHP how can i apply?

php,post
I want to know how to use POST request in PHP. I used $_REQUEST['text'] for getting data from url like http://localhost/data.php?text=ABCDEFGH but If i pass very long text than ERROR : Request-URI Too Long. if(isset($_REQUEST['text'])){ $parsetext=$_REQUEST['text']; //get data here data > ABCDEFGH }else{ echo "not valid"; } Please any one...

Unity c# - NullReferenceException: Object reference not set to an instance of an object

unity3d
Im having an error during runtime with my image and text. I have both objects created in my hierarchy named correctly but apparently my script cant find them. Why isn't what i have written not sufficient? All i get in the error is Object reference not set to an instance...

long not enough to store an integer

java,long-integer
public class SDO { public static void main(String args[]) { SDO sdo = new SDO(); System.out.println(sdo.amountOfData(1)); System.out.println(sdo.amountOfData(86400)); } public long amountOfData(int seconds) { long result = (4096*4096*seconds); return result; } } This code is returning in my test, error: amountData(1000) expected:<16777216000> but was:<-402653184>. Shouldn't type long store even higher integers?...

How can I measure elapsed time when encrypting using openssl in linux by C

linux,posix,libc
How can I calculate the amount of processing time used by a process in C on Linux. Specifically, I want to determine how much time elapses when encrypting a file using openssl.

Swift constraints error (programmatic constrains)

ios,swift,xcode6,nslayoutconstraint
I've been trying to add constraints to 2 simple labels for several hours now. I can get one of them working without any problems, but the second I try to add constraints to my other label xcode provides the following error: Unable to simultaneously satisfy constraints. Probably at least one...

Dual axis chart from the same measure in Tableau

tableau
I'm aware of how to create a dual-axis chart using two different measures for the Y-axis. Is there a way for me to create a dual-axis chart using a same measure but on two different range in the dual-axis? For example, I have a column which contains revenue, I want...

Front-end : html/css+javascript, Backend : perl

javascript,perl,frontend,backend
Want to create a web application (using html/css + javascript) that logs in to a linux based storage device, Process some logs of the storage device (using perl) and return the result to the web application. What/How to use as a connector between them? And which one would be the...

How to combine multiple rows of employee into single row in SQL Server

sql,sql-server,pivot
I'm having following table and below is expected results. Please let me known if there is a easy to way to get the expected results in SQL server. EmpNo Name Benefit StartDate Status -------------------------------------------- 0001 ABC Medical 01/01/2014 Active 0001 ABC Dental 02/02/2013 Inactive 0001 ABC Vision 03/03/2012 Active 0002...

Redis: Multiple unique keys versus bucketing through Hash

redis
I have total six type of keys, say a,b,..,f each having around a million subkeys, like a1,a2,...a99999(different in each bucket). What is the faster way to access? Having separate keys by combining bucket name and key like: a_a1,b_b1 etc. Use hash for 6 keys to have buckets and then have...

Ruby - arrays check for and replace with

javascript,ruby,arrays,loops,replace
Given: check_for = ["Lorem", "ipsum", "dolor", "sit", "amet"] replace_with = ["Donec", "ut", "libero", "sed", "arcu"] sentence = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et...

Upload multiple images in one request

ios,objective-c
I want to upload more than one image in single service request. How can I do that. As of now I am able to upload single image like as NSData *imageData = UIImageJPEGRepresentation(image, 90); NSString *boundary = @"---------------------------14737809831466499882746641449"; NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary]; NSMutableData *postBody = [NSMutableData data]; //...

How to programmatically select multiple nodes in RadTreeView in C#

c#,winforms,telerik,treeview
I want to programmatically select multiple nodes in my RadTreeView from Telerik component in a C# application. It's a winform. I've set MultiSelect property to True. But when I try this: myTree.SelectedNodes= someNodeCollection; It says: SelectedNodes has no setter Is there a way to do this programmatically?...

Mod_Rewrite: Rewrite URL to index.php but redirect index.php to root

mod-rewrite
I want to rewrite requests to use index.php which is pretty standard and works. The problem is that there are old and now invalid links which include the index.php and I want to redirect them to the root url of my site. Potential duplicates include: Rewrite URL to index.php but...

WPF Specifying HierarchicalDataTemplate for Interface

wpf,data-binding,interface,datatemplate
I've found a really strange quirk in WPF. If I specify a DataTemplate for an interface, it will work if defined inside an ItemsControl.ItemTemplate, but will not work if defined inside ItemsControl.Resrouces. Concrete example: I have a tree structure I want to represent. All items in the tree implement IHardware,...

the 'if…else' is not checking any other conditions, directly skipping to last 'else' statement

javascript,html,function,if-statement
i,m calling a JavaScript function to change an image by using if..else statement to change its source. but it directly skips to last else statement, so the image only keeps swapping between first & last image JavaScript function: function myfunction2() { var image = document.getElementById("image"); //iterartion 1 if (image.src ==...

web config file setting to live asp.net website

c#,asp.net,sql-server,web-config
this is my first asp.net project and i am trying to live it but i am not sure about setting of 'web.config' file. below error it is showing. 500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed. <?xml...

MVC 5 with owin cookie middleware - owinContext.Authentication.sign in not issuing cookies

asp.net,asp.net-mvc,cookies,forms-authentication,owin
I am using MVC 5.2 and am trying to get the Owin cookie middleware working. In my login controller i do the following: public class LoginController { [AllowAnonymous] public ActionResult Login(LoginViewModel loginViewModel) { //authenticate .... var claims = new List<Claim> { new Claim(ClaimTypes.Name, "abc"), new Claim(ClaimTypes.Email, "[email protected]") }; var id...

port forwarding multiple services with domain name on server

ubuntu,apache2
I'm currently running a ubuntu server with multiple services on different ports(apache on 80, gitlab on 41990, and other python web service on 18992 for example) I wonder is there any way to port forward these services with domain names( for example, http://gitlab.mydomain.me -> http://mydomain.me:41990 ) I've search through but...

Android listview row detail page sliding

android,android-listview,swipe,swipe-gesture
I have ListView which has many items(rows), onClick of any item goes to the DetailActivity which explains more about that particular item. If I want to see the detail of the next item, I have to come back to the ListView and click next item. How to design to see...

How to implement event listener for any objects in JavaScript

javascript,jquery,events
I want to implement custom event with this functionality: create custom event after callback of ajax dispatch event any object in document (div, grid, ...) can register listener of this custom event when event is fired, all objects which have registered listener event call any methods I tried created custom...

PHP Mailer Script Not Printing Variables In Email

php,sendmail
The issue I am having is in the message portion of the email. The email sends just fine, the outline is there but no name email or message is printed from the variable. I can't seem to see what the issue is. Any help is appreciated. <?php session_start(); $name=$_POST['name']; $email=$_POST['email'];...

Newbie: Maven execution exception

java,maven
My java file: package hello; public class helloworld { public static void main(String[] args) { // Greeter greeter = new Greeter(); System.out.println("Hello World"); } } My pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.springframework</groupId>...

remove selcted item listbox AS3

actionscript-3,listbox
I want to remove the selected item from the listbox (liste). I import information from a xml-sheet. Then I place that infomation inside a listbox with a loop. How do I remove the item that has been selected from the listbox? import flash.events.MouseEvent; var loader:URLLoader = new URLLoader(); var url:URLRequest...

In iOS - Production and staging server included in single build

ios,configuration,xcode6,settings
I have an application having two servers STAGING and PRODUCTION. I used to release two builds with changing the servers in coding part. But now my client asked to provide a single build where we can provide an option in app settings or phone settings to chnage the URL. I...

Need to get NSRanges of multiple @ symbols and the text that follows them in UILabel's text

ios,objective-c,uilabel,nsattributedstring,nsrange
I have a UILabel that contains text like this: "Hi, my name is John Smith. Here is my twitter handle @johnsmith and I work for this company @somerandomcompany. Thanks for watching!" I need to find the ranges for all of the @ symbols and whatever text comes right after them...

how to send a ajax request using laravel5 on xampp

php,ajax,laravel
routes.php Route::get('/register',function(){ $data = 'Register'; return View::make('user.register'); }); Route::post('/register',function(){ $inputData = Input::get('formData'); parse_str($inputData, $formFields); $userData = array( 'name' => $formFields['name'], 'email' => $formFields['email'], 'password' => $formFields['password'], 'password_confirmation' => $formFields[ 'password_confirmation'], ); $rules = array( 'name' => 'required', 'email' => 'required|email|unique:users', 'password' =>...

SQL exception despite providing parameters

.net,sql-server,vb.net
I am getting the following exception when trying to store data into an sql database: Procedure or function 'myFunction' expects parameter '@username', which was not supplied. This is the stored procedure i'm calling: @username varchar(20), @password varchar(20), @puntos int, @partidaGanada bit AS BEGIN DECLARE @id int SET @id = (SELECT...

EmailAddress Validation ModelValidation firing automatically even before the user finished entering data

asp.net-mvc-4,razor,email-validation,model-validation
I am using data annotation to validate mvc4 model. Field [Required(ErrorMessage="Please fill your Email Address")] [EmailAddress(ErrorMessage="Please enter your active email so we can reply to your email.")] public string UserEmail { get; set; } in my view <div class="form-group has-feedback"> <label class="sr-only" for="email2">Email address</label> @Html.TextBoxFor(model => model.UserEmail, new { @class...

perl regular expression, matching space with digit 1-12

html,regex,perl
i was trying to grab some data from a horsing data site http://www.hkjc.com/english/racing/horse.asp?horseno=P278 basically i wget the above URl and loop thru each line of the HTML source code and check if the line match regular expression, if it does, i grab some data and store it in a variable...

Create array of 24 with odd numbers as null [duplicate]

javascript
This question already has an answer here: How to determine if a number is odd in JavaScript 17 answers Here's my code: var myArray = new Array(); for (var i = 0; i < 24; i++ ){ myArray.push([i]); } How can I add/replace null values where there's 1, 3,...

Scanning using nmap

dns,nmap
folks.Is there away to use nmap to scan for open resolvers in ones network.I have this command from the nmap page but it seems itsnot working nmap -sU -p 53 --script=dns-recursion <target> ...

visual studio individual settings for typescript file

visual-studio,typescript
In my visual studio project properties I have enabled checkbox "Combine JavaScript output into file". Can I exclude some typescript files from this output? I want compile this (excluded) files to individual js files.

Map iterator behavior after 'erase'ing

c++,dictionary,stl
I was writing this code below, and found this strange behavior: #include <iostream> #include <map> #include <string> using namespace std; int main() { map<int, string> map1; map1[1] = "Hello"; map1[2] = "Hello1"; map1[3] = "Hello2"; map1[4] = "Hello3"; map1[5] = "Hello4"; map<int, string>::iterator it; for (it = map1.begin(); it !=...

Excluding a directory in .htaccess from domain root

wordpress,.htaccess,drupal-6
I have a drupal installed in our main domain. http://domain.com And a Wordpress installed in a directory domain.com/directory Sometimes when I accessed the wordpress from domain.com/directory it delivers me to domain.com/ Heres a part of .htaccess from the domain root.. <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond...

Substract two data.frames in R, by characters

r,data.frame
I have a data set of 250000+ rows. Three columns: country, test and test_result (character, character, numerical) The next line off code reduce my data to 102388 rows. sub.df1 <- df <- df[!duplicated(df), ] This line off code reduce my data to 102339 rows. sub.df2 <- unique(df[,c('country','test')]) Now i want...

Using id_key with fluentd/elasticsearch

elasticsearch,fluentd
I recently started attempting to use the fluentd + elasticsearch + kibana setup. I'm currently feeding information through fluentd by having it read a log file I'm spitting out with python code. The log is made out of a list of json data, one per line, like so: {"id": "1","date":...

Celsius to Fahrenheit program wont compile double to float error [duplicate]

java,temperature
This question already has an answer here: Multiplying float values “possible lossy conversion from double to float” 3 answers /* This program will convert Celsius to Fahrenheit and display a table of their Fahrenheit equivalents. */ // ---------1---------2---------3---------4---------5--------6---------7 // 1234567890123456789012345678901234567890123456789012345678901234567890 public class CelsiusToFarhenheit { public static void main(String[] args)...

Plotting an axis on a scatter3 figure

matlab
Hello I would like to display an axis centered on [0,0,0] of a scatter 3 plot. Is there a way to do this using the line function? http://au.mathworks.com/help/matlab/ref/line.html Not quite sure how to interpret it. Would greatly appreciate a hand. ...

UIMenuController, Where does it take its target? Confused

ios,objective-c,iphone,xcode
When I use a MenuController without any customisation, I would Do this. UIMenuController *menu = [UIMenuController sharedMenuController]; [menu setTargetRect:self.frame inView:self.superview]; [menu setMenuVisible:YES animated:YES]; menu is a shared instance and I didn't specify the target. From where the UIMenuController gets the target to perform default actions?...

Android splash screen for both landscape and portrait orientation

android,xml,splash-screen,screen-orientation
How can I modify my this code to set splash screens for both landscape and portrait orientation. I managed to work on portrait mode and it is working fine. i like ti make it for both the orientation. please modify this code. This is my SplashActivity.java. public class SplashActivity extends...

PHP Curl for encrypted pages

php,curl,encryption,web-crawler
I do a php curl to this website http://www.hoovers.com/company-information/company-search.html But it returned 404. Looks like something encrypted or what. Can you give some clue about this problem. Thanks // Get cURL resource $curl = curl_init(); // Set some options - we are passing in a useragent too here curl_setopt_array($curl, array(...

Static reshape of Eigen matrix

c++,eigen
I am experimenting with doing bicubic interpolation of some gridded data using Eigen, and I can't figure out how to reshape the 16x1 column vector of coefficients into a 4x4 matrix. Ideally I would like to do something along the lines of https://bitbucket.org/eigen/eigen/pull-request/41/reshape/diff without any copying, but I can't make...

Ruby on Rails - Sign Up Form with STI (issue with invalid signups)

ruby-on-rails,forms
I'll be straight and say that I am fairly new to the concepts relating to website design and development. Right now, I am having an issue that I cannot seem to find a solution to. I am trying to extend onto mhartl's Ruby on Rails tutorial. I created my own...

Fullpage background image not scrolling with content html5 phonegap

android,css,html5,cordova,jquery-mobile
I have a fullpage background image with following code: <html class="full" lang="en"> <body class="full" > header, footer and content.... Extending beyond the initial view. </body> </html> <style> .full { background: transparent url(../img/blur-background.jpg) no-repeat 0 0 fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } </style> My problem description is,...

Why converting numpy.ndarray to custom data type using numpy.ndarray.astype multiplies my data?

python,arrays,numpy,data-type-conversion,custom-data-type
Executing this code: import numpy as np py_list = [2013, 8, 0.6552562894775783] custom_type = np.dtype([ ('YEAR',np.uint16), ('DOY', np.uint16), ('REF',np.float16) ]) NumPy_array = np.array(py_list) NumPy_array_converted = NumPy_array.astype(custom_type) print 'custom_type is:' print custom_type print '---------------------------------------------' print 'py_list is:' print py_list print '---------------------------------------------' print 'NumPy_array is:' print NumPy_array print '---------------------------------------------' print...

Play! Scala : Json reader and additionnal class field

json,scala,playframework-2.2
I'm using Play! Scala 2.2 and I'm reading json as following and it works great : case class YoutubeTrack(//artistId: String, videoId: String, title: String, thumbnail: Option[String] ) val youtubeTrackReads: Reads[YoutubeTrack] = ( (__ \ "id" \ "videoId").read[String] and (__ \ "snippet" \ "title").read[String] and (__ \ "snippet" \ "thumbnails" \...

Java Class wont notice numbers over 9 [closed]

java,int
I need this Ten Green Bottles class to start at 10 and go down to 0. But it only starts at 9, I can't seem to get it to begin with 10. I imagine it has something to do with the "int bott_num = 9". Setting it to 8,7,6... works...

Error while adding progess bar

c++,qt
I was trying to add progress bar in qt but got the following error: error: no matching function for call to 'map(QVector<int>&, <unresolved overloaded function type>)' futureWatcher.setFuture(QtConcurrent::map(vector, spin)); The code is as follows: using namespace QtConcurrent; const int iterations = 20; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QVector<int>...