Posts

Showing posts from January, 2015

c# - "Covariance" in template parameters -

let's have these 2 classes class baseclass { protected hashset<baseclass> container; } class derivedclass : baseclass { derivedclass() { container = new hashset<derivedclass>(); } } then receive error: unable convert. since every derivedclass (should) baseclass, i'm not quite sure why error being thrown, yet is. the goal baseclass perform variety of operations on container , particularly specific behaviors tied derivedclass - among those, requiring container of type hashset<derivedclass> . how goal accomplished? every devrivedclass baseclass , not other way around. hashset<t> cannot covariant since allows write operations ( add ). in scenario possible: class baseclass { protected hashset<baseclass> container; public dosomething() { container.add(new baseclass()); // not legal if container list<derivedclass> } } you change type of contain

java - Remove items from different Lists with same Menu -

i have 2 listviews in activity , want use contextmenu remove itens 1 of them. want use same context menu, possible? looking here answers point 2 differents context menus. thanks!!! here code: //register both listviews listview1= (listview)findviewbyid(r.id.pedlstitens) ; listview1.setoncreatecontextmenulistener(this); registerforcontextmenu(listview1); listview2 = (listview)findviewbyid(r.id.pedlstcartao) ; listview2.setoncreatecontextmenulistener(this); registerforcontextmenu(listview2); after that, inflate menu: public void oncreatecontextmenu(contextmenu menu, view v, contextmenuinfo menuinfo) { super.oncreatecontextmenu(menu, v, menuinfo); menuinflater inflater = getmenuinflater(); inflater.inflate(r.layout.menu_remove, menu); } then contextmenu behavior... don't know how point right listview remove item: public boolean oncontextitemselected(menuitem item) { adaptercontextmenuinfo info = (adaptercontextmenuinfo) i

php - Specifying jQuery for auto-assigned IDs? -

in foreach loop i'm creating divs (with paragraphs inside gotten mysql databases). i'd make them clickable (/connect them jquery). problem 1: how create divs unique ids? my solution: make counter , use attribute id="divclick<?php echo htmlspecialchars($count);?>" problem 2: how write 1 jquery support divs? my unfinished solution: $(document).ready(function(){ $("#divclick").focus(function(){ $("#buttonoption").animate({width:'toggle'}); }); so, how tweak jquery reacts divs 1 specific #buttonoption activated according div clicked. simple. use shared class , data- attribute. fiddle <div data-button="<?php echo $count; ?>" id="divclick<?php echo htmlspecialchars($count); ?>" class="sharedclass"></div> then can bind click event in jquery this: $(document).on('click', '.sharedclass', function() { $("#buttonopt

SQL UNION result not the same as the result of individual statements? -

is possible union of 2 sql statements produce output different output of executing each of 2 statements separately? yes. absolutely. the union removes duplicates. if want same results, use union all . also note: ordering after union , union all not guaranteed. if want things in particular order, use order by .

C++ code crashes when ran -

#include <cstdio> #include <vector> #include <string> #include <iostream> #include <map> using namespace std; int main() { freopen("data3.txt","r",stdin); freopen("data33.txt","w",stdout); int k; string name,costume; for(int z = 0; z < 5;z++) { cin >> k; vector<string> friends; vector<string> costumes; (int = 0 ; < k; i++) { cin >> name >> costume; bool found = false; (int j = 0; j < costumes.size();j++) { if (costumes[i] == costume) found = true; } if (found) friends.push_back(name); else costumes.push_back(costume); } if (!costumes.size()) cout << "spooky\n"; else { (int = 0; < costumes.size();i++) {

javascript - Angular: Update service and share data between controllers -

i'm using service grab data api: angular.module('myapp', []) .factory('myservice', function($q, $timeout) { var getmessages = function() { var deferred = $q.defer(); $timeout(function() { deferred.resolve('hello world!'); }, 2000); return deferred.promise; }; return { getmessages: getmessages }; }); and use these data in multiple controllers. function controllera($scope, myservice) { $scope.message = myservice.getmessages(); $scope.updatemessage = function(){ $scope.message = 'hello max'; }; } function controllerb($scope, myservice) { $scope.message = myservice.getmessages(); $scope.$watch('message', function(){ // 'hello max' }, true); } i update data in every controller, when change $scope.message in controllera, doesn't fire change in controllerb. edit: thing avoid using "$broadcast" , "$

c# - this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[Monet.Models.AgentTransmission]' -

i have 2 tables in sql database, 1 storing agent ( agenttransmission ) , other logs transmission history ( transmissionhistory ) of agent (there 1 successful, or reply status "s", record on logging table per agent). i need grab information agenttransmission table according filter set based on dates of transmissionhistory table. however, since view need send looking @model ienumerable<monet.models.agenttransmission> getting following error the model item passed dictionary of type 'system.collections.generic.list1[<>f__anonymoustypeb'18[system.string,system.string,system.string,system.string,system.string,system.string,system.int64,system.string,system.string,system.nullable'1[system.datetime],system.boolean,system.string,system.string,system.string,system.string,system.string,system.string,system.nullable'1[system.datetime]]]', dictionary requires model item of type 'system.collections.generic.ienumerable'1[monet.models.agentt

The second column on my report is not formatting the same as the first column -

Image
i need table looks similar old program's report did. figured out how columns, added lines between each field both horizontal , vertical. first column formats correctly, second column adds line horizontally. see screenshot: any help? personally, prefer new version. less clutter. if want add them, can: put borders around cells. may cause problems overlap, can work around putting borders around item , price fields. use line tool draw 4 vertical lines in both detail , report header sections.

android - Can an app change its name and UI for one locale only? -

i have android app that's used internationally. the app used internationally. however, recent legal problems force me change name in u.s. alone. don't want change globally. whta's minimal set of action can take there fast can? can change application name , of ui locale only? (eng-us) must deploy new app altogether alongside old one? note must keep "british" locale old ui, myst rename application name , change of ui u.s. is possible? thank you whta's minimal set of action can take there fast can? in terms of app itself: step #1: find out how setting name in app. frequently, that's via @string/app_name resource, android:name in <application> (and perhaps in 1 or more <activity> elements) in manifest. step #2: create alternative versions of string resource other languages.

Django django-haystack cannot import CategoryBase from django-categories on the first run -

i have custom category model extends categorybase in django-categories. when put haystack index , restart server, on first run complains cannot import name categorybase categorybase cannot imported categories.base if refresh page again site runs fine , search result returns correct information. seems because of order of imports. i looked @ stacktrace , found out error originating admin.autodiscover inside urls.py imports looks in urls.py from django.conf.urls import patterns, include, url django.contrib import admin admin.autodiscover() django.conf import settings django.contrib.staticfiles.urls import staticfiles_urlpatterns django.views.generic import templateview django.contrib.sitemaps import genericsitemap galleries.models import gallery events.models import event django.contrib.auth.views import login, logout dajaxice.core import dajaxice_autodiscover, dajaxice_config core.models import staticpagesitemap articles.models import articlesitemap, issuesitem

java - Android, how to show software keyboard on click -

i have dialog box in android app; edittext control on dialog (the others spinners , buttons), , gets focus when dialog shown. prevents on-screen keyboard ever showing up, meaning can't enter text box unless have hardware keyboard. i believe (but couldn't swear it) because control starts focus, , system check whether show keyboard or not happens in onfocus event. there way programmatically show on-screen keyboard? in order implement ability force keyboard open when user presses button on screen following should help. inputmethodmanager inputmethmanager = (inputmethodmanager) getsystemservice(context.input_method_service); inputmethmanager.togglesoftinput(inputmethodmanager.show_forced,0); however alternative regain focus of dialog window can found below. code should open software keyboard resetting flags set alertdialog. code should placed after creation of dialog window. dialog.getwindow().clearflags(windowmanager.layoutparams.flag_not_focusable|windowman

python - is there a pip install plugin for maven? -

in existing java project uses python (think python plugin libre office) would use mvn install pypi (python package index). right have solution package tar in mvn , use maven-dependency-plugin unpack , maven-antrun-plugin move files python path (the libre office python path). any suggestions on better way manage on linux , windows? ideally simple maven plugin pypi. thanks input. i don't know if maven plugin can install pip package exist. use maven-exec plug-in invoke pip on specific goal. here documentation on exec plug-in mojohaus.org/exec-maven-plugin/usage.html hope helped edit: updated link

android make Action Bar activity change independent -

in app have action bar(actionbarsherlock). make action bar static/global system bar application, when switching between activities rest of view set. is possible when switching between activities , ideas how ? something not possible can use fragments support 8 api 8+ actionbarsherlock library thats not big problem little research.

php - related width of tow elements -

i have problem ,i want relate width of tow elements, first simpl div , second span ... write code: <div id="wb_name_to_menu" style="position:absolute;left:768px;top:20px;width:171px;height:18px;z-index:4;"> <span id="sp_name_to_menu" style="color:#ff0000;font-family:arial;font-size:16px;">love me!</span></div> <div id="layer_to_mainu" style="visibility: hidden;position:absolute;text-align:left;left:772px;top:22px;width:132px;height:135px;z-index:132;" title=""> <div id="wb_main_mainu" style="position:absolute;left:8px;top:9px;width:123px;height:28px;z-index:1128;padding:0;"> <div id="main_mainu"> <ul style="display:none;"> <li><span></span><span id="id_full_name_from_main_menu">love&nbsp;meeeeee</span> <ul> <li><span></span><sp

How to parse or read json file from external storage on Android app -

i implemented parsing json server (url). couldn't find way parse json sdcard (/download/example.json). can me solve issue/change code? i used asynctask this. sample tutorial or sample code more appreciated. (sorry english.) public class main extends activity { private textview shopsdisplay; private static string searchurl = "http://example.com/sample.json"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.baby); //reference throughout class shopsdisplay = (textview)findviewbyid(r.id.tweet_txt); new getshops().execute(searchurl); } private class getshops extends asynctask<string, void, string> { /* * carry out fetching task in background * - receives search url via execute method */ @override protected string doi

visual studio lightswitch - Set related entity to current user in HTML Client -

i building desk ticketing program in lightswitch, , have been having trouble 1 requested feature. asked build mobile friendly version of app end users submit tickets mobile devices. built app, couple screens, , added code preprocess query limit tickets can see own. works wonderfully. i'm having trouble assigning logged in user submitter on new ticket. i've looked @ multiple guides online, of stop short @ i'm trying do. promising i've found http://social.msdn.microsoft.com/forums/vstudio/en-us/47832659-4ed3-4a8c-9a62-b3ad46c8e8b4/get-logged-in-employee technique, can succesfully display current user on screen. the challenge is, setting ticket.enduser field currentusername field. i've tried in created method of addeditnewticket screen, , beforeapplychanges method. i've been bashing head against wall couple days now, has out there ever accomplished this? update so, think may have found problem, not sure how around it. in execute code new ticket butto

Oracle Functions - VARCHAR2 length error (PLS-00215) -

i've been messing around last 2 hours, , can't seem find helpful (i've read on solutions, me aren't working). have following create function statement: create function getbatchapprovalemail(net_id in number) return varchar2 email_address varchar2(255); cursor c1 select t1.approve_email lms.lms_status_email t1 t1.net_id = net_id begin open c1; fetch c1 email_address; close c1; return email_address; end; / for reason, upon executing statement pls-00215 error (string length constraints must in range(1 .. 32767)) . i've been reading , have said declare size varchar2 , i've tried , doesn't make difference. does have ideas? ps i'm new pl/sql possible other things aren't correct. there few errors function. check below understand those. create function getbatchapprovalemail(net_id in number) return varchar2 email_address varchar2(255); cursor c1(num number) ---using passed paramete

sql - Is there a way to create a property filter sort with Nhibernate QueryOver -

i have scenario need conduct sorting on property (user.name) in nhibernate queryover query property contains string need grab last portion of name , order asc. if doing on returned results, might like: ..... var query = session.queryover<user>()..... ..... query.orderby(u => sortbylastname(u.name)); private string sortbylastname(string name) { if (string.isnullorempty(name)) { name = " "; } var namearray = name.trim().split(' '); var lastname = namearray[namearray.length - 1]; return lastname.tolower(); } in sql combination of substring, charindex (and possibly other functions) grab last portion of name (ie. joe smith, jane a. doe) , sort on last name. question is there way in nhibernate queryover set didn't have roll in stored proc called nhibernate or passing in raw sql query through .createsqlquery(sql)? but instead build logic directly queryover? you can creating pr

Firefox rendering font differently than other browsers - fixable with feature detection? -

i understand , agree shift browser detection feature detection won't me problem: i'm using dosis font, letters displayed farther apart firefox other browsers. currently, i'm using navigator.useragent detect browser , adjust letter-spacing accordingly. now, firefox feature me make detection? the first solution comes mind that, if spaced-out letters result in overall longer text strings normal, create invisible <div> somewhere dosis text , check width. check specific error, not browser.

javascript - D3 arc gradient -

Image
i'm trying create timer using d3 has gradient change between 0 , 100%. example dark orange @ 0% , light orange @ 100%. can make arc transition between dark , light orange having problems finding allows me apply gradient arc. example of trying achieve can seen in image below. been searching/frying brain trying achieve day or now. svg not allow these kind of gradients. i've done similar before, created "donut chart" each wedge different color: http://jsfiddle.net/duopixel/gfvrk/ var arc, data, padding, steps = 2, r=400/2, pi = math.pi; var padding = 2 * r / 200; arc = d3.svg.arc() .innerradius(r-40) .outerradius(r).startangle(function(d) { return d.startangle; }) .endangle(function(d) { return d.endangle; }); data = d3.range(180).map(function(d, i) { *= steps; return { startangle: * (pi / 180), endangle: (i + 2) * (pi / 180), fill: d3.hsl(i, 1, .5).tostring() }; }); d3.select("#wheel") .insert('svg', 

Upload images using a Windows Phone 8 app -

i trying give users ability upload images using form on windows app. images should uploaded using asp.net webapi sql server db. have found similar example sure there should simpler way of doing this. the example found http://chriskoenig.net/2011/08/19/upload-files-from-windows-phone/ i not sure how use example above convert object , store db. also, if there isn't easy way, open options of uploading images external photo site solution has api, eg. flickr thanks having @ this! i found out way of using model store images quite database using webapi. please use link below refer other post upload image using asp.net webapi using model

c# - How can I force an exception if the decimal is larger than the ToString format descriptor? -

i have format decimals using various format descriptors passed code, specify varying # of significant digits left of decimal point. tostring output cannot have many digits on left side per format descriptor or should return error (format overflow). is there tostring decimal format descriptor (i not find any) or other decimal string conversion mechanism can exception if decimal larger allocated string space left side of decimal? below code throw rather work. i'm hoping more elegant/built in counting characters in format descriptor , figuring out maximum decimal myself , doing compare before attempting conversion. thanks! static void main(string[] args) { string lformat = null; decimal lvalue = 123456.5678m; // example, throw because number not fit 3 significant left side digits... lformat = "000.00"; console.writeline("format '{0}' value '{1}'.", lformat, lvalue.tostring(lformat));

3d - DrawUserPrimitives problems on Monogame -

Image
i'm trying draw simple coloured rectangle on monogame (for windows8) using 3d primitives drawuserprimitives , vertexpositioncolor , thing can see rectangle covers upper half of screen, can see in screenshot below. occurs when drawing triangle, too. here's code: // camera code camera.position = new vector3(0, 1500, 0); camera.projection = matrix.createperspectivefieldofview(mathhelper.toradians(45), graphicsdevice.viewport.aspectratio, 1, 5000); camera.view = matrix.createlookat(camera.position, vector3.down, vector3.forward); vertexpositioncolor[] vertexlist = new vertexpositioncolor[4]; basiceffect basiceffect; vertexbuffer vertexbuffer; // initializations vertexlist[0] = new vertexpositioncolor(new vector3(-957, 10, -635), color.red); vertexlist[1] = new vertexpositioncolor(new vector3(957, 10, -635), color.lime); vertexlist[2] = new vertexpositioncolor(new vector3(-957, 10, 635), color.yellow); vertexlist[3] = new vertexpositioncolor(new vector3(957,

Download Time Lapse Images in Python -

i want download jpg image refreshed every 15 seconds in web site obtain collection of files can later on assembled time lapse program video. i'm using python ver.3 i'm overwhelmed multitude of suggestions offered, opening , closing of files. isn't there simple command fetch file without opening it, , store index in name? import urllib.error import urllib.request import time imageurl = 'http://your-web-site.com/imagename.jpg' directoryforimages = '/where/you/want/to/store/image/' imagebasename = 'basename' extension = '.jpg' maxloops = 100 imagenumber in range(0, maxloops): try: # open file object webpage image f = urllib.request.urlopen(imageurl) # open local file store image imagef = open('{0}{1}{2}{3}'.format(directoryforimages, imagebasename, imagenumber, extension), 'wb') # write image local file imagef.write(f.read()) # clean imagef.clos

ruby on rails - simple form country select showing as html entities -

at point form started showing html entities instead of html country select: haml: = a.input :country html <div class="input country required"><label class="country required" for="user_account_address_attributes_country">country <abbr title="required">*</abbr></label><select class="country required" id="user_account_address_attributes_country" name="user[account_address_attributes][country]"><option value=""></option> &lt;option value=&quot;afghanistan&quot;&gt;afghanistan&lt;/option&gt; &lt;option value=&quot;aland islands&quot;&gt;aland islands&lt;/option&gt; &lt;option value=&quot;albania&quot; selected=&quot;selected&quot;&gt;albania&lt;/option&gt; turns out needed use country_se

python - Running an external script with matplotlib commands in Ipython -

i run weird problem. way writing code, first write functions on fly in ipython qt console interactively, , tweak them necessary. once satisfied results, move them py file, use functions @ later time. so, wrote function supposed plot histogram on screen. if first run py script, call function required arguments, error message, @ bottom of post. if copy , paste function code qt console, , hit enter, function works fine after point. why function work fine after copy paste qt console, not work if directly call after running script %run script.py magic? thanks ideas! here function: def plotfreqhist(w_hist_list, head, span, m): ''' generates frequency distribution plot ''' if head == 30.: tr_cond = 'normal' else: tr_cond = 'congested' histweights = np.zeros_like(w_hist_list[0]) + 1. / w_hist_list[0].size * 100 bmap = brewer2mpl.get_map('rdylbu', 'diverging', 10) colors = bma

jquery - Ajax, PHP, and mysqli -

dudwhen call php file using ajax, takes full 30 seconds before results displayed. how make results more instantaneous? my ajax is: $("#j_search").keyup(function(){ if(($.trim($(this).val()) != '') & ($(this).val() != ' ')){ $.post('../php/ajax/j_search.php', {search: $(this).val()}, function(data){ $(".matched_results").html(data).show(); }); } }); if reason think php wrong, write sample of own , test that, though doubt it. can not give php source code. i fired releasing code seems worth @ times these.. here snippet of php: class sql_commands{ //connecting vars private $_host = "localhost"; private $_user = "root"; private $_pass = "dud"; private function handle($errornum, $errormsg){//used error handler $handle = new handle(); $handle->direct($errornum, $errormsg); } function connect(

javascript - Mask first set of characters in a textbox using ASP.NET -

on webform, have field social security number. want display first 3 numbers , asterik (or mask) remaining numbers. there easy way using oob .net functionality? client side functionality because asteriks appear on 4th number through last number. wondering if there jquery library knows or client side code easy enough. i don't think have inbuilt functionality achieve this. you can replace remaining characters * in server side please check following link http://msdn.microsoft.com/en-us/library/ie/t0kbytzc(v=vs.94).aspx

jquery - Change text in text field according to link that has been clicked -

i have following. <div class="petsearch"> <input id="pet_search_input" class="" type="text" onkeypress="return isnumberkey(event)" name="query" autocomplete="off"> </div> now if user types dog in text field below link looks following. <a id="pets" href="#dog" onclick="main()"> <img title="dog" alt="dog" src="./images/dog.png"> </a> now if user types cat link appears looks following. <a id="pets" href="#cat" onclick="main()"> <img title="cat" alt="cat" src="./images/cat.png"> </a> so have jquery looks following. $("#pets").click(function () { $("#hidden_content").hide("fast"); $("#yourpet").hide("fast"); $("#pet_search_input").hide("fast"); }); now have follo

App Engine SSL - Apps not allowing SSL -

overview of problem. site running on free version of google apps on year simple web page. started developing deleted old google apps , and migrated our primary app engine account avoid billing issues of two+ accounts. couldn't app engine recognize custom domain though in domains tab of our google apps account. in searching found google limits using domains on app engine ( http://support.google.com/a/bin/answer.py?hl=en&answer=182081 scroll down app engine) had recreate separate google apps account verify ownership of domain. site , operational outside of ssl. issue when go https://admin.google.com/cpanelhome#domainsettings/subtab=domains , type app id enable ssl on domain apps account routes me create app engine app instead of billing. because app running on primary app engine account not domain account. it seems must have ran across , solved it. how enable primary google apps account verify ownership of domains , allow app engine use it? have lot of domains ho

html - How to remove whitespace of empty <select> in IE -

Image
below screenshots took on empty <select> in ie8 , chrome. happens when <select> element empty, ie8 still shows long dropdown whitespaces while chrome shows nothing (which want in ie). any ideas this? p.s. can't add dummy <option> this. you inserting empty option or optgroup this <select><optgroup></optgroup></select> or <select><option></option></select> or @shivam this <select><option selected="selected">pick option</option> but mentioned don't need dummy option. browser behaves mentioned in question default.

how to write value of variable into current edit file in vim script -

i variable's value in vim's script, , how write file i'm editing now. e.g. "=== date let todaydate=system("date") you can use :put put contents of variable (or expression) current buffer :put =todaydate the :h :put :pu :put :[line]pu[t] [x] put text [from register x] after [line] (default current line). works linewise, command can used put yanked block new lines. cursor left on first non-blank in last new line. register can '=' followed optional expression. expression continues until end of command. need escape '|' , '"' characters prevent them terminating command. example:

python - Speed up Numpy Meshgrid Command -

i generating meshgrid numpy , it's taking lot of memory , quite bit of time well. xi, yi = np.meshgrid(xi, yi) i generating meshgrid same resolution underlying sitemap image, 3000px dimensions. uses several gigs of memory , takes 10-15 seconds or more while when it's writing page file. my question is; can speed without upgrading server? here full copy of application source code. def generatecontours(date_collected, substance_name, well_arr, site_id, sitemap_id, image, title_wildcard='', label_over_well=false, crop_contours=false, groundwater_contours=false, flow_lines=false, site_image_alpha=1, status_token=""): #create empty arrays fill up! x_values = [] y_values = [] z_values = [] #iterate on wells , fill arrays data in well_arr: x_values.append(well['xpos']) y_values.append(well['ypos']) z_values.append(well['value']) #initialize numpy array required interpolation func

How to make this icon easily resizable/responsive in css3? -

i want make following icon in css3 such can width , height of ".circle" (or other wrapper element, point want adjust width , height in 1 place or make automatically fits in container regardless of width , height) without having adjust other css3 properties make "a" line in center. what best way this? if can recommend better way following appreciated. issue have changing ".circle"'s width , height smaller affects positioning of positioning of eveerything else forcing me change .circle2's properties , .letter's properties until things line up. css .circle { width: 100px; height: 100px; background: blue; -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; cursor:pointer; } .circle2 { width:80%; height:80%; border-radius: 50px; position:relative; top:5%; left:5%; border: 5px solid #fff; } letter{ position:relative;

javascript - Setting dropdown value attributes with knockout.js -

i have used example knockout tutorial stripped down essentials reproduce problem. cannot figure out how set value attribute of tags in items. added value each entry of self.availablemeals try add fails populate dropdowns @ all. when try add optionsvalue binding populates dropdowns doesn't select appropriate value. please help! <h2>your seat reservations</h2> <table> <thead><tr> <th>passenger name</th><th>meal</th><th>surcharge</th><th></th> </tr></thead> <!-- todo: generate table body --> <tbody data-bind="foreach: seats"> <tr> <td><input data-bind="value: name" /></td> <td><select data-bind="options: $root.availablemeals, value: meal, optionstext: 'mealname'"></select></td> </tr> </tbody> </table> // class repr

Facebook local currency payments - how to avoid enormously high price jumping? -

i created product (og object) priced in usd, not in eur or ils (on purpose). costs 0.08 usd. testing facebook tutorial on price jumping suggest done mobile payments. when invoke pay dialog user paying eur (which indeed set on facebook account main currency), pass quantity=25, quantity_min=19 , quantity_max=31. results in 25 of items being priced 1.50eur credit card payment, ok. if choose pay mobile phone e.g. austria, nearest price point mobile payment 2.00 eur. so, instead of increasing quantity 31 , charging 1.50/25*31=1.86 eur, plus 0.14 eur fee (like facebook tutorials suggest would) round 2.00 eur, or @ least keeping old quantity , applying 0.50 eur fee... facebook sets quantity 21, sets price 1.26 eur , fee 0.74 eur! pretty not above mentioned tutorial says should happen. when invoking user paying ils, if pass quantity=25, quantity_min=19 , quantity_max=31, credit card payment shows 7.25 ils 25 items, while mobile payment results in 15.00 ils 19 items, fee of 9.21 ils. ,

c# - How can I format date using json.SerializerSettings.Converters to look like 1288323623006 -

i using following date filter in webapi application: json.serializersettings.converters.add( new isodatetimeconverter { datetimeformat = "dd-mm-yyyy hh:mm" }); i started use front end not understand dates. if remember correctly due way milliseconds formatted many digits. what need date format this: 1288323623006 can suggest how can using serializer. different default? you don't want use isodatetimeconverter @ - possibly want use javascriptdatetimeconverter . convert new date(...) right value - believe include new date(...) part. if don't want that, you'll need write own converter. it shouldn't hard write converter - although need decide how handle different kinds of datetime . example, if you're asked convert datetime kind of unspecified , want assume it's in utc, or in system local time zone, or else? once you've got appropriate "instant" in time, need find number of milliseconds between , unix epoch

c# - Why can't I parse this string to date? -

i trying parse string datetime: string datum = "13/7/2013"; datetime dtdatum = datetime.parseexact(datum, "yyyy-d-m", cultureinfo.getcultureinfo("nl-nl")); i'm getting "formatexception unhandled user code". i've tried several formats, , different cultureinfo's, nothing seems work. i've searched on google , website, can't seem find answer gets rid of exception. help appreciated. your input format not same "format specifier defines required format of" input. the datetime.parseexact(string, string, iformatprovider) method parses string representation of date, must in format defined format parameter. so input need string datum = "2013/13/7"; ; match format specifier.

sql server - Serializing INSERTs -

if answer question depends on dmbs, i'd interested hear answer oracle 11g or higher , sql server 2012. we have table has foreign key references itself: create table versions ( id int identity(1,1) not null, [date] datetime not null, basedonversion int null -- foreign key references versions ) we have stored procedures insert new records versions table. if these running concurrently, need make sure no 2 versions reference same other version, there must not forks in version hierarchy (unless we're deliberately creating fork): how should run transaction 1 reads current version 17 transaction 1 writes new version 18 based on 17 transaction 2 reads current version 18 transaction 2 writes new version 19 based on 18 how should not run transaction 1 reads current version 17 transaction 2 reads current version 17 transaction 1 writes new version 18 based on 17 transaction 2 writes new version 19 based on 17 in second case, have 2

Error with finding area of ​​the intersection of two rectangles (objective-c) -

i make program, find area of ​​the intersection of 2 rectangles. have height, width , coordinates of rectangles. but wont work! xcode terminates program "thread 1: signal sigabrt" on line (rectangle.m): reswidth = (origin.x + width) - (second.origin.x + second.width); so, here's code: main.m: #import <foundation/foundation.h> #import "rectangle.h" #import "xypoint.h" int main(int argc, const char * argv[]) { nsautoreleasepool * pool = [nsautoreleasepool new]; rectangle *myrect1 = [rectangle new]; rectangle *myrect2 = [rectangle new]; xypoint *temp = [xypoint new]; [temp setx: 200 andy: 420]; [myrect1 setorigin:temp]; [temp setx: 400 andy: 300]; [myrect2 setorigin:temp]; [temp dealloc]; [myrect1 setwidth:250 andheight:75]; [myrect2 setwidth:100 andheight:180]; double print = [myrect1 intersect:myrect2]; nslog(@"%g", print); [pool drain]; return 0; } rectangle.h

How to configure the prefered languages of internal Eclipse browser? -

i want change prefered languages of internal eclipse browser, can't find such settings neither in search in preferences dialog nor in google. where configured? not taken eclipse, because language of eclipse menus in english, , language site (admin console of websphere) displayed german (in ff it's displayed in english, it's browser settings matters here). it seems uses system settings, @ least mars.2 & windows 8. i changed default language in internet explorer , restarted eclipse , displays pages in internal browser according selected locale.

encryption asymmetric - ECDSA for Android using SpongyCastle -

i've added spongycastle eclipse android project, don't seem able find single good/complete example of how use ecdsa encryption & decryption of plain texts. imagine should 'hello world' ecnryption libraries. can me this? or direct me towards other resource can me achieve same goals? thanks. here's example bouncycastle.org generating key, there it's standard use of keypair. @nelenkov wrote great article (as usual) on elliptic curve on android ecgenparameterspec ecgenspec = new ecgenparameterspec("prime192v1"); //using spongycastle provider keypairgenerator g = keypairgenerator.getinstance("ecdsa", "sc"); g.initialize(ecgenspec, new securerandom()); keypair pair = g.generatekeypair();

Cannot redeclare class Facebook with facebook-php-sdk-master -

i have been test successful project used codeigniter facebook-php-sdk-master user login facebook. may 2 month ago , run got errors message fatal error: cannot redeclare class facebook in ../application/libraries/facebook.php on line 24 that line have code class facebook extends basefacebook { //any code } i don't know it's make problem. search in google result because have duplicate class name. after check it. it's show no same name of class in project , other 1 why before it's run , ? have idea it? please share me . thanks try include_once code instead of include

counter - Counting lost packets with perl -

i'm writing small script returns pingtimes given host. far working should want able see how many packets lost. when run standard ping command in windows command prompt this: ping-statistic 173.194.70.138: packets: sent = 4, received = 4, lost = 0 (0%) how can make perl count everytime packet lost? there way invoke windows commands within perl? my current code below: #!/usr/bin/perl use warnings; use strict; use time::hires; use net::ping; use vars qw($argv $ret $duration $ip); $host = $argv[0] or print "usage is: $0 host [timeout]\n" , exit 1; $timeout = $argv[1] || 5; $p = net::ping->new('icmp', $timeout); if ($p->ping($host)) { $p->hires();{ ($ret, $duration, $ip) = $p->ping($host); printf("$host [ip: $ip] online (packet return time: %.2f ms)\n", 1000*$duration); } $p->close(); }else{ print "no such host, timeout of $timeout seconds reached\n"; } thanks in advance! if hos

html5 - How to use glyphicons in bootstrap 3.0 -

i have used glyphicons in bootstrap 2.3 have upgraded bootstrap 3.0. now, unable use icon property. in bootstrap 2.3, below tag working <i class="icon-search"></i> in bootstrap 3.0, it's not working. the icons (glyphicons) contained in separate css file.. . the markup has changed to: <i class="glyphicon glyphicon-search"></i> or <span class="glyphicon glyphicon-search"></span> here helpful list of changes bootstrap 3: http://bootply.com/bootstrap-3-migration-guide

tcpclient - How to connect multiple TCP IP clients to same server port using c++ -

i want connect 2 clients same server port using tcp ip. have use below code before bind:- // reuse binded socket int reuse=1; setsockopt(m_isocketid, sol_socket, so_reuseaddr, (char *)&reuse, sizeof(reuse)) listen(isocketid, 2); struct sockaddr clientaddr; socklen_t length = sizeof(clientaddr); int firstclientsocket = accept(isocketid, &clientaddr, &length); length = sizeof(clientaddr); int secondclientsocket = accept(isocketid, &clientaddr, &length); after code, have 2 client sockets work with. note, 'accept' function blocks until client connects. in general, should use aync methods (e.g. select) handle multiple clients. so_reuseaddr not intended purposes. tells system listening port can reused multiple instances of server. it's debugging, when app doesn't close socket upon exit. otherwise system might hold port time, refusing bind socket it. and don't forget error handling on listen , accept calls =)

android - Is using AsyncTask on every activity a good practise? -

i know if practice use asynctask on every activity in app? need improve speed @ activities load , asynctask should trick. there risks of doing way? if want identify taking time use traceview profile activity. bad idea try optimize before identifying culprit causing lag. with said should enable strict mode catch performance bugs early. good luck!

sql - Rails When using dependent destroy and dependent nullify -

i want know relation dependent destroy , dependent nullify on rails , relation sql. thanks example: table users , table cars user has many cars car belongs users in table car have user_id on each row if set dependent destroy when defining relationship in users, when delete user, cars having user_id deleted also if set nullify, cars remain, user_id column set null (it pointless have value there because user id deleted) hope helps

math - Python Dividing number by 99 and then checking if it is equal to number b par 2 digits -

i trying write program first of checks if can number number b swapping 2 digits. below code designed start @ 53150220288 , check if possible reach number 537163806382 changing 2 digits. trying change 2 digits of number 537163806382 new numbers multiples of 99. output them text file. writing program me maths competition. f = open('blank.txt', 'w') = 53150220288 b = 537163806382 b = str(b) c = 0 while <= 1000000000: in range(len(b)): if b[i] == a[i]: c = c else: c = c + 1 if c == 2: = str(a) print(a, file=f) else: c = 0 = int(a) = + 99 f.close() problem above code outputs absolutely nothing! don't know why? your program never enters while loop: a = 53150220288 while <= 1000000000:

css - insert content INSIDE the <p> tag with jquery -

i want add content <p> after ipsum before <a> <p id="service">service: lorem ipsum <a href="#">change</a></p> i want like <p id="service">service: lorem ipsum more content <a href="#">change</a></p> please let me know how do. $('#service>a').before(' more content ') http://jsfiddle.net/knbds/

Drools: Variables can not be used inside bindings -

i error variables can not used inside bindings on following drools-rule code rule "mingapsbetweenappointments" when $leftassignment : appointmentrequest(feasibleappointment != null) $totalvalue : number( ) accumulate( appointmentrequest(feasibleappointment != null, $leftassignment.requestid != requestid, $quality : this.getoccupiedsurroundingsvalue($leftassignment)), sum( $quality ) ) // error line scoreholder.addsoftconstraintmatch(kcontext, $totalvalue.intvalue()); end although found post question, it's not helping me much, need call function getoccupiedsurroundingsvalue other appointmentrequests, they're related. any appreciated. that code should work. there's nothing wrong far can see. double check if it's same code you're executing it. use similar code in examples , work. if it's ok, might bug in drools expert. there 2 ways procee

interface - Java Co-Variance -

for project want provide generic interface resemble workflow, like public interface iworkflow { public void start(); public void dowork(); public void end(); } for that, have lots of implementation, like public class coffeeworkflow implements iworkflow { public void start() { // setup coffee // prepare dishes // ... } public void dowork() { // drink coffee } public void end() { // wash dishes } } now want provide more information functions, like public interface iworkflowstartargs {} and especially: public class coffeeworkflowstartargs implements iworkflowargs to give method public interface iworkflow { public void start(iworkflowstartargs args); public void dowork(); public void end(); } respectivly: public class coffeeworkflow implements iworkflow { public void start(coffeeworkflowstartargs args) { } } but not work, not recognized impl