Posts

Showing posts from February, 2015

c++ - Why can't the compiler resolve an overload of a std::function parameter? -

this question has answer here: wrap overloaded function via std::function 1 answer observe following example: #include <iostream> #include <functional> #include <cstdlib> void print_wrapper(std::function<void(int)> function); void print(int param); int main(){ print_wrapper(print); return exit_success; } void print_wrapper(std::function<void(int)> function){ int = 5; function(i); } void print(int param){ std::cout << param << std::endl; } this works correctly, , prints 5 . now @ same example overloaded function added: #include <iostream> #include <functional> #include <cstdlib> void print_wrapper(std::function<void(int)> function); void print(int param); void print(float param); int main(){ print_wrapper(print); return exit_success; } void print_wrapper(std::functio

Call Function in Same Level Property in Javascript -

i have object this. want call encodetoken inside callback in refreshtoken property. can body me how javascript work this? thanks. var obj = { encodetoken: function (obj){ var opt = {expiresinminutes: 1} return jwt.sign(obj, config.jwt_key, opt); }, decodetoken: function (token, callback){ jwt.verify(token, config.jwt_key, function (err, decoded){ callback(err, decoded); }); }, refreshtoken: function (token, callback) { this.decodetoken(token, function (err, decoded){ callback(err, howtocall.encodetoken()); }); }, }; refreshtoken: function (token, callback) { var self = this; this.decodetoken(token, function (err, decoded){ callback(err, self.encodetoken()); }); } you can read great explanation here - see simple call , as object method chapters - or here .

openerp - Odoo: Connect Bank Account -

i interested know, possible connect odoo online banking system? actually interested connect bank account odoo , wire transfer. is there existing module available can this? you can start trying this, go settings/configuration/invoicing/bank & cash , , there configure company bank accounts , there other options manage payments using paypal,manage payments using ogone,manage payments using adyen, manage payments using buckaroo , never used but, don't miss nothing trying.

javascript - AJAX and JS, Cannot read JSON data? -

i have following ajax code: var ajax = new xmlhttprequest(); axaj.open("post", "index.php", true); ajax.setrequestheader("content-type", "application/x-www-form-urlencoded"); ajax.onreadystatechange = function(){ if(x.readystate == 4 && x.status == 200){ var returnval = ajax.responsetext; } } ajax.send("nextmax=-1"); and pairs php ends with: echo json_encode(array( 'next_id' => $nextid )); exit(); this works, is. if print out returnval inside ajax call, prints out correct array, correct value: {"next_id":"935210077606657948"} but cannot access id directly. i've tried var nextid = returnval.next_id; and var nextid = returnval['next_id']; and other variations, return undefined . how array elements within returnval ? thanks in advance. found solution not 30 seconds after posting question. in same place: switch var returnval =

ios - ModuleName-Swift.h file not found inside of CocoaPod Project -

Image
issue i have cocoapod project created using pod lib create . there objective-c classes can used inside example project — trying add nsobject subclass written in swift. the swift class created , bridging header added classes directory. i try import swift bridging header .m file of class inside pod project: #import "proflyoutviewcontroller-swift.h" when compile 'modulename-swift.h' file not found when import statement is: #import <modulename/modulename-swift.h> or #import "modulename/modulename-swift.h" it compiles , usable! but... i return file, indexing runs (i assume) , of sudden get: modulename/modulename-swift.h file not found . autocomplete broken on file , use of class shows warning. question when using trying use swift bridging header within files of pod project, how should imported? need in order autocomplete working , compilable? see below example of tabledemo project to import swift code object

html5 - HTML Prefetch Resources -

this might silly question want ask if prefetching resources js scripts , images slows page load. eg: if have page number of these links: <link rel="prefetch" href="http://example.com/images.png" /> will downloading them included in page load time or prefetching (which using idle browser time) not part of page load time stats? does happen in background in idle time or part of page load? thanks this browser dependent: android browser, firefox, , firefox mobile start prefetch requests after window.onload, chrome , opera start them possibly stealing tcp connections more important resources needed current page. starting ie11, individual network requests prioritized type, in order. the root document of webpage css stylesheets woff fonts script libraries images loaded using onload event handlers synchronous xmlhttprequest (xhr) requests asynchronous script requests (such indexeddb, web workers, file api, , others) asynchronous

Rails App With Custom Domain on Heroku Redirecting to Random Website -

i'm helping friend out rails app, , morning custom domain started automatically redirecting freelancer.com instead of app. automatically created heroku subdomain, i.e. 'randomapp.herokuapp.com' still working fine without issue. no new changes have been pushed heroku repo approximately week, , custom domain worked fine months - until morning. hacked? maybe problem dns? insight appreciated i'm not particularly versed in this. thank you! is domain still set in heroku settings? if so, problem has domain service configuration. should check if domain's cname entry still leads heroku app. , change password if there's suspicious going on.

c++ - Get precise line/column debug info from LLVM IR -

i trying locate instructions in llvm pass line , column number (reported third-party tool) instrument them. achieve this, compiling source files clang -g -o0 -emit-llvm , looking information in metadata using code: const debugloc &location = instruction->getdebugloc(); // location.getline() // location.getcol() unfortunately, information absolutely imprecise. consider following implementation of fibonacci function: unsigned fib(unsigned n) { if (n < 2) return n; unsigned f = fib(n - 1) + fib(n - 2); return f; } i locate single llvm instruction corresponding assignment unsigned f = ... in resulting llvm ir. not interested in calculations of right-hand side. generated llvm block including relevant debug metadata is: [...] if.end: ; preds = %entry call void @llvm.dbg.declare(metadata !{i32* %f}, metadata !17), !dbg !18 %2 = load i32* %n.addr, align 4, !dbg !19 %sub = sub i32 %2, 1, !dbg !19 %

vb.net - I get An unhandled exception of type 'System.InvalidCastException' -

i keep getting invalidcastexception each time use code. can help? working on program called crystal. crystal library of games. label1.text = "please wait..." 'this game's info can use reasons. label1.text = "getting game info..." dim filereader string filereader = my.computer.filesystem.readalltext(gamepath \ "crystal\gamename.txt") '<-------- error here 'this check contents, make sure correct. label1.text = "now checking contents..." if my.computer.filesystem.directoryexists(gamepath \ "crystal") label1.text = "yup. crystal game." else msgbox("this not crystal game. make sure crystal folder in package. ") me.close() end if 'crystal folder files 'this check gamename.txt label1.text = "checking crystal folder data..." if my.computer.filesystem.fileexists(gamepath \ "crystal\gamename.txt&quo

ios - Unable to Get UIButton to Fade In on ViewDidLoad -

as stated in title, unable uibutton fade in on viewdidload method. here code far: viewcontroller.swift import uikit import quartzcore class viewcontroller: uiviewcontroller { @iboutlet weak var nextbutton: uibutton! override func viewdidload() { super.viewdidload() self.nextbutton.fadein(duration: 10.0, delay: 10.0) } } uiviewextensions.swift import foundation import uikit extension uiview { func fadein(duration: nstimeinterval = 1.0, delay: nstimeinterval = 0.0, completion: ((bool) -> void) = {(finished: bool) -> void in}) { uiview.animatewithduration(duration, delay: delay, options: uiviewanimationoptions.curveeasein, animations: { self.alpha = 1.0 }, completion: completion) } func fadeout(duration: nstimeinterval = 1.0, delay: nstimeinterval = 0.0, completion: (bool) -> void = {(finished: bool) -> void in}) { uiview.animatewithduration(duration, delay: delay, options: uiviewanim

jquery - Displaying object at xy position defined in Ruby on Rails model -

i working on trying pull x , y position model in ruby on rails , represent in html 5. position has been captured through jquery drag , drop, not able find information on how proceed. to make more clear. have x-position , y-position variable set. need place interactable image on page @ location saved in method. thanks , feel free let me know if there way more clear. edit:: this controller table model (very new ror), class tablescontroller < applicationcontroller before_action :set_table, only: [:show, :edit, :update, :destroy] skip_before_filter :verify_authenticity_token # /tables # /tables.json def index @tables = table.all end # /tables/1 # /tables/1.json def show end # /tables/new def new @table = table.new end # /tables/1/edit def edit end # post /tables # post /tables.json def create @table = table.new(table_params) respond_to |format| if @table.save format.html { redir

ruby - Convert orientation (N, S, SE, SSE etc) to bearing angle -

is there functionality in ruby or gem convert string orientation (examples in title) bearing in degrees, bearing defined follows? a numerical value representing direction in degrees, true north @ 0° , progressing clockwise. this works 8 main cardinal directions: def cardinal_direction_degrees(s) h = {n: 0, ne: 45, e: 90, se: 135, s: 180, sw: 225, w: 270, nw: 315} h[s.to_s.downcase.to_sym] end puts cardinal_direction_degrees('n') #=> 0 puts cardinal_direction_degrees('sw') #=> 225 you can add remaining directions adding more elements hash.

Display commas in textbox VB.net -

i have textbox gets value calculation. i'm trying display commas when value on 999.99 i've tried convert.todecimal , convert.tostring doesn't seem work. here code populates field. appreciated. iskmade1.text = convert.todecimal(ipu1.text) * convert.todecimal(units1.text) the iskmade1 field displays decimal correctly, isn't adding commas number. provided have mydecimalvariable variable in store decimal values format textbox text follows: dim mydecimalvariable decimal = 1234.56 iskmade1.text = mydecimalvariable.tostring("#,##0.00") or have: dim mydecimalvariable decimal = 1234.56 iskmade1.text = mydecimalvariable.tostring("n", cultureinfo.invariantculture) in case need import system.globalization namespace.

java - How to know in which item a button was clicked -

so far have list view custom adapter, , each item in list has button. im confused; im trying following: when user clicks on button(a delete button) in item in list, want know in item button clicked can know item delete-how implement this? ive seen setting tags, im still lost. i have tried reach button list layout main activity, , cannot reference it. please can give me detailed description on how want thanks. added adapter code: public class locationadapter extends baseadapter{ string [] n; context context; string[] a; private static layoutinflater inflater=null; public locationadapter(mainactivity mainactivity, string[] names, string[] addresses) { // todo auto-generated constructor stub n=names; context=mainactivity; a=addresses; inflater = ( layoutinflater )context. getsystemservice(context.layout_inflater_service); } @override public int getcount() { // todo auto-generated method stub return n.length; } @override public objec

How could I utilize algorithms for nearest neighbor search to do fixed radius search? -

there lots of works nearest neighbor search problem, wonder if want fixed radius range search , utilize algorithms nearest neighbor search? perhaps kth-nearest-neighbor search on , on again until find point beyond radius range, suppose might cause lot of waste. not "there lots of works nearest neighbor search problem," there many questions asked problem. important number of dimensions. make sure check answer if not sure why dimension important. high dimensional space assuming points lie in high dimensional space, should go locality-sensitive hashing (lsh) . nice implementation of algorithm e²lsh . provide slides , if want implement or better understanding of happens. note e²lsh solves randomized version of r-near neighbor problem, call (r, 1 − δ)-near neighbor problem, δ has approximation, mention in manual . you can check answer regarding lsh here . have used in c++ , recommend fixed radius search want perform! low dimensional space use cgal&#

ruby - Can not start the rails server due to some SQL server configuration error -

i getting following error when trying start rails server ""rails server" in cmd. error: exiting c:/ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-3.2.13/lib/ac tive_record/connection_adapters/sqlserver_adapter.rb:440:in `execute': closed co nnection (tinytds::error) the followings gem , database.yml file. database.yml: # mysql. versions 4.1 , 5.0 recommended. # # install mysql driver # gem install mysql2 # # ensure mysql gem defined in gemfile # gem 'mysql2' # # , sure use new-style password hashing: # http://dev.mysql.com/doc/refman/5.0/en/old-client.html development: adapter: sqlserver mode: dblib encoding: utf8 reconnect: false database: swargadwara_puri pool: 5 username: sa password: chandra123 dataserver: owl002\sql2012 # warning: database defined "test" erased , # re-generated development database when run "rake". # not set db same development or production. test: a

dspace - How to restore PostgreSQL database to initial state as it was after fresh install -

i using postgresql database dspace project. inserted records in tables want script of database become empty contains data in table automatically inserted during fresh install. [dspace]/bin/dspace database clean [dspace]/bin/dspace database migrate swap in actual dspace install directory [dspace]. according the official dspace documentation : running "dspace database clean" followed "dspace database migrate" return database fresh install state

model view controller - Storing more information using FormsAuthentication -

i want store more information in same cookie. can add values authentication cookie or have use second http cookie? want add firstname, lastname, return firstname lastname public void signin(p_userlogon_list_result user, bool createpersistentcookie) { if (user == null) throw new argumentnullexception("user"); if (user.username == "administrator") { user.role_name = "administrator"; var cookie = new labcookie { username = user.username, firstname = user.name, lastname = user.family, rememberme = false, // roles = new list<string> { "administrator" } roles = new list<string> { user.role_name ?? "user" } }; string userdata = jsonconvert.serializeobject(cookie); var ticket = new formsauthenticationticket(1, cookie.usern

Cloud Dataflow Running really slow when reading/writing from Cloud Storage (GCS) -

since using release of latest build of cloud dataflow (0.4.150414) our jobs running slow when reading cloud storage (gcs). after running 20 minutes 10 vms able read in 20 records when read in millions without issue. it seems hanging, although no errors being reported console. we received email informing latest build slower , countered using more vms got similar results 50 vms. here job id reference: 2015-04-22_22_20_21-5463648738106751600 instance: n1-standard-2 region: us-central1-a we had similar issue. when side-input reading bigquery table has had data streamed in, rather bulk loaded. when copy table(s), , read copies instead works fine. if tables streamed, try copying them , reading copies instead. workaround. see: dataflow performance issues

jython 2.7 - Python import Error : cannot import module named _counter (which is a .so file) -

i 'm using jython execute python script connect_host.py uses paramiko module connect specified host. paramiko module internally uses crypto module, , crypto.util module uses counter.py in turn tries import _counter ,which present in same location crypto.util .so file . on execution, python throws following error: file "/location/helper/connect_host.py", line 3, in <module> import paramiko file "/python/modules/paramiko/__init__.py", line 69, in <module> transport import securityoptions, transport file "/python/modules/paramiko/transport.py", line 32, in <module> paramiko import util file "/python/modules/paramiko/util.py", line 32, in <module> paramiko.common import * file "/python/modules/paramiko/common.py", line 98, in <module> crypto import random file "/python/modules/crypto/random/__init__.py", line 29, in <module> crypto.random impor

ssl - IBM Worklight 6.2.0.01 HTTP Adapter failed to read xml from web site with HTTPS -

i have http adapter retrieves xml file website through https. ssl certificate real , valid certificate, not self-signed one. used fine , working on year. i upgraded worklight 6.2.0.01.20150129-1911 , adapter failed. the error worklight server below: fwlse0101e: caused by: [project mobileapp5062]javax.net.ssl.sslpeerunverifiedexception: peer not authenticatedjava.lang.runtimeexception: http request failed: javax.net.ssl.sslpeerunverifiedexception: peer not authenticated @ com.worklight.adapters.http.httpconnectionmanager.execute(httpconnectionmanager.java:233) @ com.worklight.adapters.http.httpclientcontext.doexecute(httpclientcontext.java:185) @ com.worklight.adapters.http.httpclientcontext.execute(httpclientcontext.java:169) @ com.worklight.adapters.http.http.execrequest(http.java:148) @ com.worklight.adapters.http.http.invoke(http.java:137) @ com.worklight.integration.model.procedureinvoker.invokeprocedure(procedureinvoker.java:57) @ com.workli

sql server 2012 express - How to activate application roles using typed dataset in C#? -

i working in windows c# 2013 project has sql server 2012 express database, have created 3 application roles, use typed dataset in project, search way activate application role in project. i found information not complete answers, made code not working, because event connection_statechange not fire, here code in class class1 in project put code: public string rl, rlpss; //rl, rlpss variables contain role name , password. public void setapprole(sqlconnection ta) { if (ta.state==connectionstate.open) { ta.close(); } ta.open(); ta.statechange += connection_statechange; } void connection_statechange(object sender, statechangeeventargs e) { if (e.originalstate==system.data.connectionstate.closed && e.currentstate==system.data.connectionstate.open) { system.data.sqlclient.sqlcommand scm = new sqlcommand(); scm.connection = (sqlconnection)sender; scm.commandtext = "exec sp_setapprole '" + rl + "

asp.net mvc - Web API 2 routing fails for literal segment -

i'm facing issue web api 2 routing literal segments. in 1 project, have asp.net mvc , webapi2 running together, project running mvc areas. under each area, there api folder contains apis. i'm facing issue when trying request following url: {host}/accesscontrol/api/reporting/bookings . accesscontrol here area name reporting controller bookings literal segment. the error i'm getting: no action found on controller 'reporting' matches request. this controller should receive request: [routeprefix("accesscontrol/api/reporting")] public class reportingcontroller : apicontroller { [route("bookings")] [responsetype(typeof(booking))] [httpget] public async task<ihttpactionresult> bookings(string q = null) { //code data return ok(bookings); } } when remove [route('bookings')] attribute, request working regardless if bookings segment there or not. this configuration of routing

scala - Hoes do Spray Parameters work? -

i'm trying wrap head around how spray has implemented directives, , in particular parameter extraction dsl. i understand magnet pattern (barely) stuck on how paramdefmagnet , paramdefmagnet2 work together. def parameter(pdm: paramdefmagnet): pdm.out = pdm() trait paramdefmagnet { type out def apply(): out } trait paramdefmagnet2[t] { type out def apply(value: t): out } type paramdefmagnetaux[a, b] = paramdefmagnet2[a] { type out = b } def paramdefmagnetaux[a, b](f: ⇒ b) = new paramdefmagnet2[a] { type out = b; def apply(value: a) = f(value) } i'm trying work out how paramdefmanget2 implicitly converted paramdefmagnet the below implicit method. object paramdefmagnet { implicit def apply[t](value: t)(implicit pdm2: paramdefmagnet2[t]) = new paramdefmagnet { type out = pdm2.out def apply() = pdm2(value) } } if call parameter("name") , how "name" implicitly converted paramdefmagnet ? , if converts paramdefmagnet2 first, va

ios - How to write to Sharepoint 2013 list using the Rest API -

i have been stuck week now, want write sharepoint list, usin rest api provide. api looks this, http://site/_api/lists , , here can read , write depending on append url, can read lists without issues, have issues when have write. i supposed send in content-type, accept, x-requestdigest headers, , post body when write list. code nsstring *devicetoken = [self getdevicetokenfromcoredata]; nsstring *postdata = [nsstring stringwithformat:@"{ \"__metadata\": { \"type\": \"sp.data.testlistitem\" }, \"title\": \"test title\" }"]; nsdata *methodbodydata = [postdata datausingencoding:nsutf8stringencoding]; nserror *error; nsdata *jsonstring = [nsjsonserialization jsonobjectwithdata:methodbodydata options:0 error:&error]; nsstring *accepttype = @"application/json;data=verbose"; nsstring *requestdigest = _requestdigest; nsurl *subscribeurl = [[nsurl alloc] initwithstring:subscribeurlstr

ios - Prons and Cons of using objectForKey and valueForKey? -

as know there difference between objectforkey , valueforkey . objectforkey: datatype : (id)akey whereas valueforkey: datatype : (nsstring *)key . i know topic discussed on stackoverflow not provide me satisfaction. please not mark duplicated i referred : difference between objectforkey , valueforkey? what difference between valueforkey:, objectforkey:, , valueforkeypath:? finally nsstring type of id . why apple provide valueforkey on objectforkey . think there performance problem or other. question if objectforkey satisfied requirement of valueforkey need of valueforkey ?

angularjs - Is this the correct use for a Directive? -

i have been tasked setting initial application structure large angular application, came across few blog posts said should directive (which agree with) have feeling have took idea far.. what have got - when navigate portal ui-router load portal template templates folder, that's inside actual template <portal-view></portal-view .. portalview directive entire view wrapped in directive. route angular.module('portal').config([ '$stateprovider', '$urlrouterprovider', function ($stateprovider, $urlrouterprovider) { $stateprovider.state('portal', { url: "/", templateurl: "templates/portal.tpl.html" }); }]); portal.tpl.html <div class="container"> <portal-view></portal-view> </div> portalview directive angular.module('portal').directive('portalview', function() { return { controller: 'portalcontroller', controlleras: 

liferay 6 - Not able to get file object Using YUI IN Internext Explorer -

i trying upload file using yui. below code works fine in firefox , chrome.but not working in ie 8. this.portlet_view_object.delegate('change', function(e) { ...... var filefield = y.one('#newcase_file_'+context.imagecount); var file = filefield._node.files[0]; if(!context.maxfilesize.call(context,file)){ return; } .... here, maxfilesize, method pass file object , perform operation related fiel(e.g. filesize, filename). in firefox , chrome, getting file object filefield._node.files[0]; same thing not working in ie 8,and getting below error. _node.files.0' null or not object any suggestions welcomed. thanks. this issue isn't related yui, ie. .files holds multiple selected files, ie8 not support methos , can select 1 file. therefore property isn't recognized. you can use workaround: if ('files' in filefield._node) var file = filefield._node.files[0]; else var file = filefield._nod

javascript - Ajax returning blank response -

i'm working on simple script want see request , response sent server , recieved @ client via ajax. server returning status 500 . doing wrong? below script. javascript: <script> function loginjs() { var xmlhttp; if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.open("get","http://my-website.com/ajax_exp.php",true); xmlhttp.onreadystatechange=function() { alert("state "+xmlhttp.readystate+" status "+xmlhttp.status); if (xmlhttp.readystate==4 && xmlhttp.status==200) { alert(xmlhttp.responsetext); } } xmlhttp.send(); } </script> ajax_exp.php <?php header('access-control-allow-origin: http://my-website.com/ajax_exp.php'); add_action('wp_ajax_my_action', 'my_action'); add_action('wp_ajax_nopriv_my_action', 'my_act

java - android soft keyboard not showing on button click -

this question has answer here: close/hide android soft keyboard 63 answers here method on buttonclick not working... have tried many things nothing seems work public void open_keyboard(view view) { message.msg_l(this, "keyboard clicked"); inputmethodmanager imm = (inputmethodmanager) getsystemservice(context.input_method_service); imm.showsoftinput(view, inputmethodmanager.show_implicit); } please try this, inputmethodmanager imm = (inputmethodmanager) getsystemservice(context.input_method_service); imm.togglesoftinput(inputmethodmanager.show_forced,0);

php - How to clear values of keys in redis -

i running 2 instance of php application, 1 live , 1 beta. using redis in live server caching data. storing article category key , article id values. recently mistake connected beta server redis , has messed redis cache. mean has added other article ids in wrong keys. started getting wrong data redis. my question "is there way clear values of redis keys?" i don't want clear keys values of it. i had gone through redis document , found flushall , del etc.. based on doc delete keys seems. i using predis php library communicate redis server. can me delete values redis server. when "clear" value of key, redis remove key. put differently, can't have keys no values.

Verilog: "... is not a constant" -

i have 3 wires created this: wire [11:0] magnitude; wire [3:0] bitsend; wire [3:0] leadingbits; all of them assign ed expression using combinational logic. following code works fine: assign leadingbits[3] = magnitude[bitsend + 3]; assign leadingbits[2] = magnitude[bitsend + 2]; assign leadingbits[1] = magnitude[bitsend + 1]; assign leadingbits[0] = magnitude[bitsend + 0]; however, following (seemingly equivalent) code gives error bitsend not constant : assign leadingbits[3:0] = magnitude[bitsend + 3:bitsend]; can not use shorthand assignment? why error raised in second case not first? in verilog can't use variable (i.e. bitsend ) end of range. can use +: / -: operator solve issue: assign leadingbits = magnitude[bitsend+3 -: 4]; in first case calculate single index (it's not range). that's why compiler not complaining it.

iphone - UIActivityViewController Facebook and Twitter share not working in released iOS version -

we have released iphone app share fb & tw using uiactivityviewcontroller zigzag app on app store. my device working perfect device used development. users downloaded app not able share using function. nsstring *txttoshare = @"please try awesome ios app"; nsarray *objectstoshare = [nsarray arraywithobjects:txttoshare, nil]; uiactivityviewcontroller *activityvc = [[uiactivityviewcontroller alloc] initwithactivityitems:objectstoshare applicationactivities:nil]; [self presentviewcontroller:activityvc animated:yes completion:^{ }]; if ([activityvc respondstoselector:@selector(popoverpresentationcontroller)]) { // ios 8+ uipopoverpresentationcontroller *presentationcontroller = [activityvc popoverpresentationcontroller]; presentationcontroller.sourceview = sender; // if button or change self.view. } can tell me why? i had same issue , resolved using following technique declared 2 constants static nsstring *const twitterappbundlestringforos8 =

Text view losing characters that is to be displayed [Android] -

Image
i have text displayed in text view. text contains 200 lines of data, each line having 10 characters. total 2000 characters . text view inside vertical scrollable view. the first 50 lines not getting displayed . if text view had limitation number of characters, fair enough if loses last few lines, but why taking off head?? . , limit on number of characters text view?? my code: <scrollview android:id="@+id/scroll_layout_ecg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/btn_ecg" android:layout_alignleft="@+id/btn_ecg" android:layout_alignstart="@+id/btn_ecg" android:layout_marginbottom="16dp" android:layout_margintop="16dp" > <textview android:id="@+id/tvecg_samples" android:layout_width="wrap_content" androi

java - File.delete() fails to delete files in a directory -

after writing text files directory, trying delete empty files written printwriter. file.delete() function fails delete file. below code writing , deleting. private static void writefile(arraylist<arraylist<string>> listrowval, string szoutputdir, arraylist<string> listheader){ printwriter pw = null; try { arraylist<string> listcells = listrowval.get(0); int icells = listcells.size(); for(int k=0; k<icells; k++){ string language = listheader.get(k); string szfilename = "files_"+ language +".csv"; pw = new printwriter(new filewriter(szoutputdir + file.separator + szfilename)); for(arraylist<string> listncrcellval : listrowval){ string szval = listncrcellval.get(k); if(szval != null && szva

escaping - PHP script escapes special characters after switching servers, how to fix it? -

i have primitive script accepts post request (utf-8 text) , sends e-mail using ob_start() , echo , ob_get_clean , @mail . it worked until switched servers, , text modified - special characters escaped ( " becomes \" , \ -> \\ , on), , there spaces around character combinations (not sure why). assume it's matter of php configuration. how can disable escaping? i hope can out. it seems php.ini has magic_quotes turned on it supposed obsolete option in php not eliminated until php version 5.4.0. http://php.net/manual/en/security.magicquotes.php to disable it, can reconfigure php.ini like: ; magic quotes incoming get/post/cookie data. magic_quotes_gpc = off ; magic quotes runtime-generated data, e.g. data sql, exec(), etc. magic_quotes_runtime = off ; use sybase-style magic quotes (escape ' '' instead of \'). magic_quotes_sybase = off

asp.net mvc - Alternate and fast option for AppFabricCache? -

i looking better n optimal solution can replace appfabriccache , improve performance of asp.net-mvc application. according microsoft , azure cache (the name of redis offering) should used development on azure instead of appfabric cache. think that's rather endorsement redis , alternative if want deploy application azure. that said, distributed cache performance in specific scenarios: when deploy application multi-machine farm , need consistency of cached data. hurt performance if have 1 machine or if want cache read-only lookup data. network call slower memory lookup. you should consider, why want replace appfabric cache? doesn't work you? may encounter same problems if change solution. for example, synchronization problems always appear if host appfabric or memcached on web servers themselves. both web server , cache use lot of cpu (and ram) during high traffic. lead problems, delayed requests, timeouts or ... sync problems. redis avoids these because the

Is there any way to stop the batch jobs (.cmd and .bat) rather that force taskkill using batch script? -

is pressing ctrl + c while running batch job , taskkill /f /im cmd.exe same? actually want close 3 batch jobs ((2)cmd's , (1)bat files) through batch script. found there no command stop start. don't want kill parent image name (cmd.exe) using force taskkill. manually used press ctrl + c terminate job. don't want use more. there way kill/stop running job rather force taskkill? time! this has set 1 of console programs. you'll need write program it. generateconsolectrlevent sends specified signal console process group shares console associated calling process. bool winapi generateconsolectrlevent( dword dwctrlevent, dword dwprocessgroupid ); parameters dwctrlevent [in] type of signal generate. parameter can 1 of following values. value meaning ctrl_c_event 0 generates ctrl+c signal. signal cannot generated process groups. if dwprocessgroupid nonzero, function succeed, ctrl+c signal not received processes within specified process group.

c# - Group/Ungroup Excel functionality in WinForms Grid -

Image
i want achieve following functionality xtragrid. taken excel 2010 , action of grouping (data -> group rows). the solution have far use master-detail functionality of xtragrid, use "link" existing row row, creating parent-child relation between them. using master-detail grouping displayed above mix linking grouping. ok want somehow separate them visually. to achieve + , - signs , vertical dark bar in left thought of adding additional column in grid contains either imagine of dark vertical line or button. any appreciated. (if question has been posted before , answered please point me in direction , delete thread). thank , have day. sir in gridview please set showgrouppanel property true in columns properties set groupindex group columns

generics - Grunt: How to generically run less task on multiple files that the watch task detects? -

how can set grunt script run less task on multiple files watch task detects? is possible without using "grunt.event.on('watch'..." hack? this solution works 1 file, when 2 files saved @ same time (in visual studio) 1 css generated. the script: 'usestrict'; module.exports = function (grunt) { grunt.initconfig({ globalconfig: globalconfig, less: { all: { options: { compress: false, }, files: '', }, }, watch: { all: { files: [ 'main/**/*.less', ], tasks: ['less'], options: { nospawn: true } } } }); grunt.loadnpmtasks('grunt-contrib-less'); grunt.loadnpmtasks('grunt-contrib-watch'); grunt.

android xml drawable image on full screen background -

i need xml drawable (for cordova splash screen) in android. want display transparent logo centered on screen (without stretching), while rest of screen has background color set. what tried first, add image in xml file: <?xml version="1.0" encoding="utf-8"?> <bitmap android:src="@drawable/splashscreen" android:gravity="center_horizontal|center_vertical" /> this showed logo centered on screen, (obviously) has no background color. so tried different solutions add background color xml. example: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <solid android:color="#ffffff" /> </shape> </item> <item> <bitmap android:src="@drawable/splashscreen"

php - How can I update my table after X minutes? -

how can update table after x minute action i send request: $req = query("update clients set lockclient = 0 id = $id") and want create event after 5 min. update clients set lockclient = 1 id = $id i tried create event stored procedure , imposible delimiter $$ create procedure proc ( idclient integer ) begin create event updateclientlock on schedule @ now() + interval 5 minute on completion not preserve enable begin update client set lockclient = 0 id = idclient ; end end$$ delimiter ; is there way this? by using cron job file x mins can it automatically call after specified time given

How to use CSS background url to SVG inside the HTML file -

i'm trying link background: url(#myid); , id svg element. <svg id="myid"></svg> is possible? doing wrong? .spesial { width: 100px; height: 100px; background-image: url(#test); } <svg id="test" xmlns="http://www.w3.org/2000/svg" width=100 height=100 viewbox="0 0 1500 1500"> <metadata>copyright (c) 2015 original authors @ fontello.com</metadata> <path transform="translate(0 500)" stroke="#a4e" d="m929 11v428q-18-20-39-37-149-114-238-188-28-24-46-38t-48-27-57-13h-2q-26 0-57 13t-48 27-46 38q-88 74-238 188-21 17-39 37v-428q0-8 6-13t12-5h822q7 0 12 5t6 13z m0 586v14t-1 7-1 7-3 5-5 4-8 2h-822q-7 0-12-6t-6-12q0-94 82-159 108-85 224-177 4-2 20-16t25-21 25-18 28-15 24-5h2q11 0 24 5t28 15 25 18 25 21 20 16q116 92 224 177 30 24 56 65t26 73z m71 21v-607q0-37-26-63t-63-27h-822q-36 0-63 27t-26 63v607q0 37 26 63t63 26h822q37 0 63-26t26-63z" /> </svg>

image - Regex for a Microsoft Word search -

i editing large book document lot of picture. have number of sections in text fields similar this: {includepicture "c:\\book\\nikond5500\\chapter_1-129.jpg" \d} i trying run regex find , copy find phrase between 2 curly bracket {} , paste in other document. ideally need picture names "chapter_1-129.jpg" (and on) list. you can run simple vba macro iterates fields in document this: option explicit sub listimagefields() dim ofield field dim odocsource document dim odoctarget document dim result string each ofield in activedocument.fields if ofield.type = wdfieldincludepicture result = result & getpicturesourcefromfieldcode(ofield.code) & vbcrlf end if next set odoctarget = documents.add odoctarget.range.text = result end sub function getpicturesourcefromfieldcode(byval fieldcode string) string dim startindex integer dim endindex integer startindex = instr(fieldc

google compute engine - Issue with Creation of new Instances becuase of unallocated External IP -

i tried creating compute instances in us-central1-a , us-central1-b , instance created , gets terminated because , compute engine service not able assign external ip address . while machine gets started external ip gets assigned after ip unassigned machine , halted. ps: there no issue quota limitation. can try again, seems post there issue yesterday. update: see link additional information. temporary issue , solved.

math - Find the largest sum of three sequential values in SQL? -

say have following table, called revenues . id | revenue ------------ 1 | 345 2 | 5673 3 | 0 4 | 45 5 | 4134 6 | 35 7 | 533 8 | 856 9 | 636 10 | 35 i want find largest sum of grouping of sequential 3 values. here's mean: ids 1 + 2 + 3 => 345 + 5673 + 0 = 6018 ids 2 + 3 + 4 => 5673 + 0 + 45 = 5718 ids 3 + 4 + 5 => 0 + 45 + 4134 = 4179 ids 4 + 5 + 6 => 45 + 4134 + 35 = 4214 ids 5 + 6 + 7 => 4134 + 35 + 533 = 4702 ids 6 + 7 + 8 => 35 + 533 + 856 = 1424 ids 7 + 8 + 9 => 533 + 856 + 636 = 2025 ids 8 + 9 + 10 => 856 + 636 + 35 = 1527 in case, want result 6018 , since it's largest sum of 3 sequential values. i'm starting learn sql, other previous language being java, , can think how easy loop. have idea on how started writing query this? similar thing exist in sql? edit: furthermore, possible scale this? if had big table , wanted find largest sum of hundred sequential valu

php - Redirect all routes who starts with a specified word to homepage -

i have problem .htaccess. file .htaccess : rewritecond %{request_uri} ^/paiement rewriterule .* /index.php rewritecond %{request_uri} ^/paiement/test1/ [or] rewritecond %{request_uri} ^/paiement/test2/dfd/$ [or] rewritecond %{request_uri} ^/paiement/test3/lkjjk [or] rewritecond %{request_uri} ^/paiement/test4/fdf/fdfd/?$ rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -d rewriterule .* - [s=1] rewriterule ^(.*) /another/$1 [qsa,l so want redirect routes starts /paiement index.php. me please. thx in advance. sorry, found solution, it's necessaire make redirect root, : rewritecond %{request_uri} ^/paiement rewriterule (.*) / [r=301,l]

browser - HTML "POST" without "GET" -

do modern browsers (with javascript) support means can "push" content them, or notify them change can re-query page if needed? objective is: user has queried page, displays data. underlying data changes, , i'd page, if still open in user's browser, update, without using client based polling mechanisms. can technically done, , if yes, link can read more great.

javascript - How can I clear the timeout jQuery function from a different view on Ajax? -

this jquery: var timer, mydiv = $('#mydiv'); $(document).on('mousemove', function(ev) { var _self = $(ev.target); cleartimeout(timer); if (_self.attr('id') === 'mydiv' || _self.parents('#mydiv').length) { return; } if(!mydiv.hasclass('show')) { mydiv.fadein(); } timer = settimeout(function() { mydiv.fadeout(1000, function() { mydiv.removeclass('show'); }); }, 1960); }); i need stop on loading different view (i'm on ajax). so purpose, in view used code: $(document).ready(function() { cleartimeout(timer); }); it's not working, what's possible reason? update this try under suggestion, doesn't work, #mydiv has become intermittent: <iframe id="divframe" src="http://my/frame.com/" seamless="seamless" scrolling="no" frameborder="0" hspace="