Posts

Showing posts from June, 2015

Chrome Extension sendMessage error from content script to background html -

i updated chrome extension json version 2, , trying extension work again. problem sendrequest depreciated along way. copy code https://developer.chrome.com/extensions/messaging.html script , modify own variable names, , doesn't work. so go , put in original code , still doesn't work. have read multiple questions similar [and won't closed duplicate, because none of them same situation]. manifest.json: { "background": { "page": "background.html" }, ... ... ... "content_scripts": [ { "css": [ "style.css" ], "js": [ "jq.js", "script.js" ], "matches": [ "http://*.craigslist.org/*/*.htm*" ] } ], ... ... ... "permissions": [ "tabs", "http://*.craigslist.org/*/*.htm*" ], "manifest_version": 2, "update_url": "http://clients2.google.com/service/updat

Loop through an array consisting of numbers and strings, but return sum of only numbers ActionScript -

this should pretty basic, there aren't many tutorials actionscript out there. javascript close, can't find how either. want able have mixed array consisting of string , number data types, loop through array , sum of numbers while ignoring strings. example array: var myarray:array = [13, 10, "blah", 5, "eh", 10, "twenty", "thirty"]; something following should trick: var total:number = 0.0; (var i:int=0; i<myarray.length; i++) { if(myarray[i] number) total += myarray[i]; } trace(total);

knockout.js how to init tinymce? -

i trying integrate timymce knockout, idea is, when click on link, show content non-editable, click on test edit open tinymce. , create button save , switch edit model view model. here sample code , tinymce didn't work now... help. and how should debug knockout? sample code here: http://jsfiddle.net/princa/zadek/3/ 1) need these bindings bind tinymce knockout model. https://github.com/stevesanderson/knockout/wiki/bindings---tinymce 2) html textareas , display areas. <a href="javascript:void(0)" data-bind="click:function(){showeditor(true)}">show editor</a> | <a href="javascript:void(0)" data-bind="click:function(){showeditor(false)}">hide editor</a> <br/> <div data-bind="text: fieldone, visible:!showeditor()"></div> <div data-bind="css:{'nodisplay':!showeditor()}"> <textarea class="tinymce" data-bind="tinymce: fieldone&quo

grails - Paypal Sandbox IPN always fails -

i'm developing grails app using http://grails.org/plugin/paypal plugin. i've followed instructions, configured app work dyndns (no-ip). i can access app outside network. payment correct, if click on "back test's store" link returns site. the problem no ipn sent ipn handler. in ipn history can see transactions in error state, no http response code shown. it retries 8 times each message. notification url correct. what else can try? i answer myself, looks paypal not send ipn posts url ports other 80 or 443

powershell - cmdlet says parameter cannot be retrieved: expression must be readable -

my cmdlet has get-deal command, receive value pipeline: [cmdlet(verbscommon.get, "deal")] public class getdealcmdlet : insightbasecmdlet { private list<object> _legalentities = new list<object>(); [parameter(position = 0, mandatory = true, valuefrompipeline = true,valuefrompipelinebypropertyname = true)] public list<object> legalentity { set { _legalentities = value; } } protected override void processrecord() {...} } it works fine if passed list of string or other types. if passed object created in search-deal : foreach (...) { psobject dealvalue = new psobject(); dealvalue.properties.add(new psnoteproperty(legalentity,convert.toint32($deal.properties["legalentityid"].value.tostring()))); dealvalue.properties.add(new psnoteproperty("name",deal.properties["name"].value.tostring())); writeobject(dealvalue); } i error : pipeline input cannot processed because default value of pa

javascript - this.parentNode returns undefined when run using Firefox -

when following code run via firefox , click x button, javascript returns tmpfield undefined. need parentnode of button div. <head> <title></title> <script type ="text/javascript"> function removeitem() { if (document.addeventlistener) { var container = document.getelementbyid("inputcontainer"); var tmpfield = this.parentnode; alert("field: " + tmpfield); } } </script> </head> <body> <table width="100%"> <tr> <td style="width: 10%; vertical-align:top;">field:</td> <td id="inputcontainer"> <div id="divinput1" style="display: inline;"> <input id="txtcomment1" name="txtcomment" type="text" maxlength="35" /> &l

python - Qt: Alternatives to QTable for large datasets -

i'm writing application displays content of database table. application shall display image associated each tuple/row, among textual , numeric data. the trouble dealing huge data sets (up 50k entries). user will, of course, never see more few entries @ once. should still able browse data in table-like view. regarding visual appearance, qtable job. but, after reading blog posts this, qtable seems pretty slowish such tasks, understandable since, let's 50k entries, on order of 50k widgets qobjects need created. i though of using qslider replacement scrollbar of table , fixed layout. whenever slider changed, content of gui-elements make rows adjusted. however, there widget and/or solution provides , feel of qtable allows me generate widgets displayed? many in advance. overriding paint-method of corresponding delegate-class solves problem. cmannett85.

cocoa touch - Macro Recording in iOS -

is possible record set of touch events on iphone , playback? have searched alot not find answer. if possible, can explain example. m not looking testing purpose. within application, instead of creating animation, want record set of events , want playback explain app flow users. regards. recording pretty simple. @ various " responding touch events " , " responding motion events " methods on uiresponder . create own uiview subclass (since uiview inherits uiresponder ) , keep copy of events passed relevant methods. playback bit more complicated; there's no way make uitouch or uievent objects (so can't make fake event , pass on -[uiapplication sendevent:] ). but, there's nothing stopping manually parsing array of event objects , handling on own (aside being kind of ugly code).

c++ - std::find not operating as expected -

std::find not evaluating expected. i have vector lexeme_ defined as static const std::string delimiters_[] = {" ", ",", "(", ")", ";", "=", ".", "*", "-"}; static std::vector<std::string> lexeme_(std::begin(delimiters_), std::end(delimiters_)); i have evaluation using std::find defined as while ( std::find(lexeme_.begin(),lexeme_.end(),std::string(&commandline_.at(position_))) == lexeme_.end()) { // concat each successive alphanumeric character 'token' token += commandline_.at(position_); // update index 'commandline' position_ += 1; } the evaluation supposed compare char in lexeme_ char in commandline similar java expression !lexeme.contains(character.tostring(commandline.charat(position))) the evaluation supposed compare char s , if determines char in delimiters satisfied in comparison, while loop exit. testcase

xml - How to get attribute values if they are not equal to some values? -

i have xml like: <movies> <movie name="aaa"> ... </movie> <movie name="bbb"> ... </movie> <movie name="ccc"> ... </movie> <movie name="ddd"> ... </movie> <movie name="eee"> ... </movie> </movies> i name of movie if not 'aaa', or 'bbb', or 'ddd'. output be: ccc eee because have several restrictions, don't think it's suitable use 'xsl:if'..i wrote xslt (i'm using xslt 1.0): <xsl:value-of select="movies/movie/@name[not(self::aaa) , not(self::bbb) , not(self:ddd)]"/> but compiler complained there syntax error in sentence..and can't figure out why.. so me this? many thanks!! try xpath expression: movies/movie[@name!='aaa' , @name!='bbb' , @name!='ddd']/@name or one: movies/

form action doesn't use php and instead appends php filename to url -

i'm stumped. use code pattern elsewhere , works fine, i'm getting undesired behavior in instance. i've searched , found no other reference issue. my form code: <form method="post" id="quoteform" action="process_acceptance.php"> <table> <tbody> <tr><h1>contract confirmation</h1></tr> ... <tr> <td><input type="hidden" name="record_number"></td> <td><center><b><input type="submit" value="approve" /></b></center></td> </tr> </tbody> </table> </form> the php redirects user thank page , processing (as noted earlier, code functions elsewhere, i'm including can see action isn't going black hole of sort): <?php // release user ignore_user_abort(true); header('connection: close&#

ios - Passing UIImage between ViewControllers -

in first view controller have uiimage property synthesized in implementation file. in second view controller pushed, create uiimage object there , @ same time set uiimage property first view controller. in end, dismiss second view controller. however, appears image not saved after viewcontroller dismissed. understanding since uiimage pointer, data passing reference , since controller dismissed, uiimage. correct , there better way accomplish task? reference, using arc. in first view controller (firstvc), @property (strong, nonatomic) uiimage *image; in second view controller, [firstvc setimage:self.ivaruiimageview.image]; where ivaruiimageview defined as: @property (strong, nonatomic) iboutlet uiimageview *ivaruiimageview; now lets in third view controller, have in viewdidload method: imgview = [[uiimageview alloc] initwithimage:firstvc.image]; where imgview defined as: @property (strong, nonatomic) iboutlet uiimageview *imgview; you want make sure uiima

mysql - setting a php if statement to execute function only once? -

i have table called profile_views on site counts how many times person views users profile. trying let users see how many visiters they've had profile in week, , every week on monday want table emptied count can restart 0. i trying create php if statement says every week on monday carry out delete mysql query. have got perform if day monday, trying find way execute once, preferably @ 00:00am monday morning, because dont want deleting results in table throughout whole of monday. <?php $today=date(l); // find today is? using date function // if today monday displays message "today monday" , displays image1.gif if($today==tuesday) { // compare $today name of day. $result = mysql_query("delete ptb_profile_views;") or die(mysql_error()); } ?> what looking named cron - use invoke php script on desired weekday @ desired time.

javascript - Display text based on drop down selection (code works on jsfiddle but not website?) -

i having issues code somewhere can't figure out. here jsfiddle link document.getelementbyid('email-list').onchange = function() { var = 1; var mydiv = document.getelementbyid(i); while(mydiv) { mydiv.style.display = 'none'; mydiv = document.getelementbyid(++i); } document.getelementbyid(this.value).style.display = 'block'; }; works fine on there can work on either of 2 different websites local on wamp or live. missing something? your js fiddle example works because have selected onload option in jsfiddle. make sure have wrapped code window.onload window.onload = function(){ document.getelementbyid('email-list').onchange = function() { var = 1; var mydiv = document.getelementbyid(i); while(mydiv) { mydiv.style.display = 'none'; mydiv = document.getelementbyid(++i); } document.getelementbyid(this.value).style.display = 'block'; }}; js fiddle ex

asp.net mvc - MVC updating deletes data -

i have added 2 fields(a, b) table. have these fields populated when new registration. however, when update form without fields included, seems erase values in fields (a, b). there way set validations in controller or model prevent them being updated, when not passing values update it? entity framework updates fields have changed. ef sees null value change if field has data. you should instead retrieving record, updating fields want change, re-saving.

iis 7 - How to manage sub-domains on winhost with URL Rewrite and ASP.NET Optimization's bundles -

i using asp.net mvc4 winhost. just question asked here , ran same issue: i'm trying out winhost , i'm running issues sub-domains. on winhost, can have multiple sub-domains per hosting account, each sub-domain points root website. e.g. can have www.example.com, sub1.example.com, , sub2.example.com of them display content @ http://www.example.com/ . other hosts allow point sub-domains sub folder in website. allow point sub1.example.com /sub1, sub2.example.com /sub2 , www.example.com /. winhost recommends using asp/aspx page redirect http://sub1.example.com http://sub1.example.com/sub1 , points /sub1. while work, i'd not have subdomain in url twice. so tried using iis7 url rewrite point http://sub1.example.com /sub1. ben powell describes in detail on his blog . i've managed portion work http://sub1.example.com points virtual application "/sub1" in iis. if use url.content, works flawlessly. now, using asp.

php - phpmailer body with variables -

i'm trying implement "forgotten pass" php script generate new password , send email user. until moment i'm trying send new password user. cant include variable in body of email. error on line: $mail->body = "the new password "$newpass"." in browser im getting parse error: syntax error, unexpected '$newpass' (t_variable) i know im missing something, dont know what... suggestions more welcome regards format such: $mail->body = "the new password " . $newpass . "."; you use: $mail->body = "the new password {$newpass}."; php has loads of handy string tricks buried in manual here .

javascript - Check element's original value for automatic blur function? -

using javascript/jquery, want automatically change color value opposite on focus text inputs, return them original color on blur. far best i've come storing value in associative array id key , accessing way, don't want have go route. there better options? thanks! use jquery's .data() on element in question. it's built want do. $(whatever).focus(function() { var item = $(this); item.data("origval", xxx); }).blur(function() { var item = $(this); var originalvalue = item.data("origval"); // whatever want original value }); fyi, might better create "active" class , use css control color: $(whatever).focus(function() { $(this).addclass("active"); }).blur(function() { $(this).removeclass("active"); }); then, define normal color in css , special color when active class present. can add/remove "active" class , let css control color.

javascript - jQuery title flashing -

i'm working on basic chat script , having slight hickup following code. basically, i'm trying make page title "flash" similar how facebook does. <script> $(function(){ var title = $("title"); var flash = setinterval(function(){ $("#chatbox_2").toggleclass('notify'); (title.text == 'blah') ? title.text("new message...") : title.text('blah'); }, 900); }); </script> if console.log(title.text()); returns blah can see i'm doing wrong? change title.text == 'blah' title.text() == 'blah'

postgresql - where public schema is defined in postgres -

i did search, couldn't clear clue. there 'public' schema in postgres. schema defined? see when create new db. more want know defined , how change it. thanks in advance. yang the public schema created in template0 , template1 databases initdb command when database cluster initialised. when create new database template1 database copied (cloned) create new database unless specify different template. contents of template database copied, new database starts out public schema. you can customise template1 database - or make new databases use templates, specifying them template option create database command. see the documentation on template databases . if want custom templates i'd recommend making new db template , customising how want. it's reasonable drop public schema.

c# - Writing to an XML file using standard microsoft libraries -

i trying write values xml file using function. retaining value under sql_connection, receiving error, "object reference not set instance of object." understand error means, not know how work xml files. how should approach problem? when step through code stops @ mynode.value = sql_connection; says returning null value, sql_connection sees value entered on admin page. in advance. public void savesqlconnection(string sql_connection) { xmldocument myxmldocument = new xmldocument(); myxmldocument.load("c:\\users\\fthompson11\\webfile.xml"); xmlnode root = myxmldocument.documentelement; xmlnode mynode = root.selectsinglenode("/connectionstring"); mynode.value = sql_connection; myxmldocument.save("c:\\users\\fthompson11\\webfile.xml"); } i have tried doing this: public void savesqlconnection(string sql_connection) { xmldocument myxmldocument = new xmldocument();

Do I need to do a PIVOT in this Sql Server 2012 Query? -

i'm not sure if need pivot extract data simple result set. if do, how? context. each location can exist in 0<->many counties. each location, display counties in same result (say .. comma seperated). sample data locations id name ------------- 1 street1 2 street2 3 county1 4 county2 5 neighbourhood12121 6 country4 counties locationid countyid --------------------- 1 3 1 4 2 3 5 3 eg. street1 exists inside county1 , county2 street2 exists inside county1 neighbourhood12121 exists inside county1 rest not exist in counties. results i love following results: id name counties ------------------------------------------------- 1 street1 county1, county2 2 street2 county1 3 county1 null 4 county2 null 5 neighbourhood12121 county1 6 country4 null is possible sql server 2012? to comma-separated list,

hql - NHibernate and custom SQL subquery (using temp table) -

is possible use custom sql sub query "in" parameter. currently, build sub query (subqueryestate) it's complicated chunk of sql can take time process larger datasets. code generating query using our existing sub query follows: session.queryover(() => calias) .withsubquery.whereproperty(x => x.cpe.id).in(subqueryestate) .joinalias(x => x.costs, () => acosts, jointype.leftouterjoin) .joinalias(x => x.open, () => aopen, jointype.innerjoin) .list(); to improve speed of execution have idea use temp table (transactional life-cycle) populate id's. idea either join temp table or use simpler sub query (select id temp_table) instead of more complicated original. can use table isn't mapped sub query in nhibernate? can write custom sql or create detached criteria pass parameter in clause? preserve fact nhibernate producing correct sql remainder of query. ideally like: session.queryover(() => calias) .withsubquery.whereproperty(x => x.cpe.i

jaxb - Nillable on @XmlAnyElement -

i made general class plural elements jaxb. @xmltransient public abstract class plural<s> { @xmlanyelement(lax = true) private collection<s> singulars; } with following classes, @xmlrootelement public class item { //@xmlvalue // problem xsi:nill , "" @xmlelement(nillable = true) private string name; } @xmlrootelement public class items extends plural<item> { } when declare name @xmleement(nilalble = true) , works fine. @xmlvalue makes problem between xsi:nil , "" . is there way set nillable = true on @xmlanyelement ? update ---------------------------------------------------------- when item#name annotated @xmlelement , following xml marshalls , unmarshalls successfully. <items xmlns="http://jinahya.googlecode.com/xml/bind/test"> <item id="-4939700912221365683"> <name xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nil="true"/

Shiro - how to login with hashed password -

i using shiro secure application, , problem how login hashed password following scenarios: 1, automatically login user after click on activation email. 2, login via facebook, find user facebookid database, , try login in, have hashed passwrod, have ways decrypt hashed password. this how encrypt password stored in database: new sha256hash(password).tohex() below login code. subject currentuser = securityutils.getsubject(); if (!currentuser.isauthenticated()) { usernamepasswordtoken token = new usernamepasswordtoken(email, password, rememberme); currentuser.login(token); } bear me if question weird, , in advance. the purpose of hash function undecryptable. no, can not decrypted. achieve both goals can configure additional realms. 1 email activation, other oauth login. for email activation can create temporary account, create random activation token , send email. user clicks activation link , application tries authenticate user token provided in http

ios - Refreshing Viewcontroller? -

i have 2 viewcontrollers in storyboard project. once click tableview row in viewcontrollerone display contents of row passing value , settext labels in viewcontrollertwo. when tried third viewcontroller , clicking button third viewcontroller sending same arrayname different values not displaying in label in viewcontrollertwo. why? how can refresh viewcontroller on viewdidload or while moving viewcontrollertwo ? currently, add code viewcontrollertwo's viewdidload: method. [self.view setneedsdisplay] you can reload view controller putting in applicationdidbecomeactive [yourcontroller reloadinputviews]; however, why don't reload tableview using same tableview.

ef code first - When exactly does Entity Framework Fire a SQL Command? -

suppose have code like: public void testwhensqlfires() { var db = new db(); // ef dbcontext var items = db.simpleobjects; // simpleobject implements interface iid var byid = whereid(items, 1); var array = byid.toarray(); } protected ienumerable<iid> whereid(ienumerable<iid> items, int id) { return items.where(i => i.id == id); } at line in testwhensqlfires() sql run against database? (this question spun off comments on this answer ) one way find out , test yourself: open sql server management studio, open new query, select database ef running against , run query: select top 10 deqs.last_execution_time [time], dest.text [query] sys.dm_exec_query_stats deqs cross apply sys.dm_exec_sql_text(deqs.sql_handle) dest order deqs.last_execution_time desc this tells past 10 queries have run against database. set breakpoint on first line of testwhensqlfires(), run code, run above query after stepping on each line. you'll find: //

intuit partner platform - How to know which version of QuickBooks (Pro/Premier/Enterprise) the user is using with IPP v2? -

edit: i'm not looking software. want able figure out version of software user using. doesn't company object holds information see here: https://ipp.developer.intuit.com/0010_intuit_partner_platform/0050_data_services/0500_quickbooks_windows/0600_object_reference/company i know can flavour , version (year), didn't see way edition. reason want because pro version doesn't have sales order feature, , our app should know this. pro & premier both return standard_stratum enterprise returns - bel_stratum thanks jarred

google spreadsheet - Spread TRANSPOSE function over non-adjacent columns -

when create array in google spreadsheets , , use transpose function on array, new array, in first cell has transpose formula , remaining cells have continue function. i want put new column between each column in new array, whenever add column, cells of array on right of new column shift left taking on new column, such there no gaps between new array cells. i tried cutting , pasting continue functions elsewhere, change reversed every time. an ideas on how split transpose function on non-adjacent columns? note: reason want want add data against each column new array. thanks in advance. use noexpand function. example: =noexpand(transpose(a1:a10)) this transpose array 10 contiguous cells. however, should able insert columns within output, , shift continue functions accordingly. https://support.google.com/drive/bin/answer.py?hl=en&answer=71291

php - Echo the next article or previous article with urls -

the nest.php page below contains multidimensional array $laws , , contains groups of laws chapters comprise of several articles in them. i have made previous article , next article dynamic url links echo 1 article after sequentially. but php code should add these (2) urls skip next chapter when last article of particular chapter has been echoed? <?php session_start(); $laws=array( "group1"=>array( "1"=>array( "1"=>"this article (1) in chapter (1) of (group1)", "2"=>"this article (2) in chapter (1) of (group1)", "3"=>"this article (3) in chapter (1) of (group1)", ), "2"=>array( "1"=>"this article (1) in chapter (2) of (group1)",

How to access Wpf application from a browser? -

i have wpf application (not wpf browser appliction) , want accesss wpf aplication browser. how can this? we call silverlight friend

android using apache poi to create .xls file -

i'm using apache poi in android create .xls file, using linux pc(incase matters). following tutorial http://www.youtube.com/watch?v=m2zzl8tk-wg&list=plql5cpdt7hjp3qp4dowlc6wguljfxldia&index=2 copied code exactly, when part when hits refresh , creates .xls file, mine not create it. when hit refresh button seems refreshes, nothing happens, no errors, no file being created. besides in folder shows in, tried looking in every other folder see if created somewhere else whatever reason, not finding anything. doing wrong? never mentions in video changing in manifest storage, figured thats possibility. ideas appreciated thanks.

How to find the edge points of a line in matlab? -

Image
i have plotted line in matlab , want find out coordinates line crosses edges: any suggestions or advices? =) function xy-limits -1 1. here code far: yp = -1 + (1-(-1)).*rand(1,2); xp = -1 + (1-(-1)).*rand(1,2); = (yp(2)-yp(1)) / (xp(2)-xp(1)); b = yp(1)-a*xp(1); xlim([-1 1]) ylim([-1 1]) xlims = xlim(gca); ylims = ylim(gca); y = xlims*a+b; line( xlims, y ); find equation line, ie: y=a*x+b solve x using lower/upper y-limit, if resulting x within x-limits, is/are edge point(s). solve y using left/right x-limit, if resulting y within y-limits, is/are edge point(s). done so resulting points within limits green dots in te following picture, resulting points outside limits red ones.

scroll - Let Emacs move the cursor off-screen -

is possible let emacs have cursor moved off-screen, gui text editors work? 1 of biggest things bothers me when use emacs on gui editor. when scroll down, cursor "pushed forward" top of buffer. i had thought impossible, because hard-wired architecture of emacs, saw multiple-cursors , secondary cursors (assuming prevent scrolling functions acting on secondary cursors). maybe possible use multiple-cursors have main cursor in hidden buffer, , effective cursor being edit with? or maybe other clever trick? or maybe googling has failed me , possible without magic? there new package available on gnu elpa called scroll-restore attempts remedy problem. far, have encountered few bugs, package seems work as-advertised part. you can test out installing with m-x package-install ret scroll-restore ret after package installed, can enable minor mode with m-x scroll-restore-mode personally, binding scroll lock key because seems incredibly apropos! adding init file

C++: too few arguments in function call -

i have problem in code. when call functions. compiler show error: "too few arguments in function call" ............................................................ bool check_matrix(int x, int y){ if (x<rows || y<columns) return true; return false; } bool compute_duplicate(int x, int y, int array[], int array_length){ (int i=0; i< array_length; i++) { if(array[i]==compute_address(x,y)) return false; } return true; } //////////////////////////////////// (int i=0; i<array_length; i++){ if ((check_matrix(x,(y+1))==true) && compute_duplicate((x,(y+1), array, array_length)==false)) { array[i]= compute_address(x,(y+1)); y++; d++; i++; } if ((check_matrix((x+1),y)==true) && compute_duplicate((x+1),y, array, array_length)==false)) { array[i]=compute_address((x+1),y); x++; d++; i++; } array_length=d; }

c# - Booksleeve, error thrown when trying to open connection after connection was closed -

i cannot re-connect redis db doing following: create new redisconnection called "connection" open connection connection.open().wait(); close connection connection.close(true); now when attempt connection.open().wait(); error thrown "connection closed". i aware connection closed why cannot re-open it? the same happens if instead of close connection, shut down redis server, let client raise closed event, re-start server, , attempt open connection connection.open().wait(); again. "connection closed" error thrown. what wrong approach? not seem able manage connection states booksleeve. thanks it not expected usage open , close booksleeve connection. since multiplexer, expected opened once , used multiple callers concurrently (it thread-safe etc) opening involves various handshakes (at both network , protocol levels) ensure correct operation - best avoided (it isn't insanely expensive, note) no ongoing state viable once c

c# - Get Object reference not set to an instance of an object error from static member -

Image
i have static class this: public static class applicationlist { public static list<applicationsmodel> applicationsmodels { get; set; } } i want use applicationsmodels in class class program { static void main(string[] args) { getapplicationnamefromappconfigandaddtoapplicationlist(); } private static void getapplicationnamefromappconfigandaddtoapplicationlist() { list<string> applicationname = configurationmanager.appsettings["appname"].split(',').tolist(); foreach (var variable in applicationname) { applicationlist.applicationsmodels.add(new applicationsmodel { datetime = datetime.minvalue, name = variable }); } } } but applicationlist null , error object reference not set instance of object. this static prpoerty , can't create instance form static prpoerty well have p

qt - Crash on using the opengl graphics system -

i have made qt/qml application works fine in raster mode. qapplication::setgraphicssystem("raster"); but change opengl, crashes following messages: hijackwindow() context created qmlapplicationviewer(0xbfce6e5c) 1 qglcontext::makecurrent(): failed. qglframebufferobject: unable resolve framebuffer object extensions - make sure there current context when creating framebuffer object. qglwindowsurface: failed create valid fbo, falling qglpixelbuffer: unable find context/format match - giving up. qglwindowsurface: failed create valid pixelbuffer, falling qglcontext::makecurrent(): failed. qglwindowsurface: using plain widget window surface qglwindowsurface(0x932b428) qglcontext::makecurrent(): failed. qglshader: not create shader vertex shader simpleshaderprog (mainvertexshader & positiononlyvertexshader) failed compile qglshader: not create shader fragment shader simpleshaderprog (mainfragmentshader & shockingpinksrcfragmentshader) failed compile qglshader

synchronization - Can one explicitly lock/unlock implicit synchronized lock on an object in java -

yes synchronized locking synmtax easy because of it's block structure can't use it. there way explicitly lock , unlock "synchronized" monitor on object compatible prior usages of "synchronized" ? class myobj { object locker_ = new object(); void lockedmethod() { synchronized(locker_) { .... } } iterator locktraversal() { explicitlywaitforandacquirelock(locker_); // assume not throw exception return(getaniterator()); } void unlocktraversal() { explicitlyreleaselock(locker_); } } myobj obj = (...) try { iterator = obj.locktraversal(); for(;;) // iterate } { obj.unlocktraversal(); } of course in example "closures" eliminate need, "stack scoped" destructors ;^> ... you can't on object's intrinsic lock, can use java.util.concurrent.locks.lock instead. if need it, feeling risky, , aren't worried portability, can

Matlab: how to write a vector of a few points as a continuous function? -

i have 2 vectors: x = [0; 1; 2] y = [2.0000; 0; -14.7781] if plot x , y see 3 points on xy -plane. want connect 3 points , them continuous function: y = f(x), y(0) = 2; y(1) = 0; y(2) = -14.7781; y(0.5) = value between 2 , 0. for example y can treated zoh (zero order held) continuous signal. i saw matlab has function called d2c , converts model discrete continuous time. have no idea how link vector have already. how matlab? ok, latest edit improves situation lot. however, still not demarcate problem sufficiently. zoh simple >> x = [0; 1; 2]; >> y = [2.0000; 0; -14.7781]; >> f = @(new_x) y(find(x <= new_x, 1, 'last')); >> f(0.5) ans = 2 however, not think mean, y(0.5) = value between 2 , 0 part of question indicates. perhaps want linearly interpolated value: >> f = @(new_x) interp1(x,y, new_x); >> f(0.5) ans = 1 or cubic splines interpolation: >> f = @(new_x)

log4j - How to configure logger for jackrabbit-standalone-2.6.0.jar -

i'm trying setup logging program using jackrabbit-standalone-2.6.0.jar. archive contains slf4j-packages (org.slf4j, org.slf4j.helpers, org.slf4j.impl, org.slf4j.spi) far can see no logging framework. when add slf4j-log4j12-1.7.2.jar messages: slf4j: found binding in [jar:file:/d:/anwendungen/eclipseplugins/jackrabbit/jackrabbit-standalone-2.6.0.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: found binding in [jar:file:/d:/anwendungen/eclipseplugins/slf4j-1.7.2/slf4j-1.7.2/slf4j-log4j12-1.7.2.jar!/org/slf4j/impl/staticloggerbinder.class] is there opportunity see kind of implementer used here? i want configure logger. right writes big amount of debug messages file called "jackrabit.log_is_undefined" , urgently need suppress this. there several hints found in internet suggesting setup logger don't understand need do. classes "domconfigurator" , "propertyconfigurator" not available within package, when adding example "slf4j-log4j

c# - How to find out windows service status which is running on another server from one server? -

normally when required know 1 of service status in existing server means easy finding result servicecontroller pasted below code: servicecontroller sc = new servicecontroller("servicename"); if ((sc.status.equals(servicecontrollerstatus.stopped)) || (sc.status.equals(servicecontrollerstatus.stoppending))) { // start service if current status stopped. sc.start(); } here know service status of machine, how can find out result can 1 able guide me on scenario. there's constructor of servicecontroller takes machine name second parameter. http://msdn.microsoft.com/en-us/library/ssbk2tf3.aspx have tried it?

c++ - Why can't a struct be passed as value as template non-type parameter? -

non-type template parameters ones aren't types , example: template<int x> void foo() { cout << x; } there other options int in case, , i'd refer this great answer . now, there's 1 thing bugs me: structs. consider: struct triple { int x, y, z; }; triple t { 1, 2, 3 }; template<triple const& t> class foo { }; now, using normal nontype reference semantics, can write: foo<t> f; what's worth noting here t can't constexpr or const , because implies internal linkage, means line won't compile. can bypass declaring t const extern . might bit weird, 1 made me wonder why isn't possible: foo<triple { 1, 2, 3 }> f; we decent error compiler: error: triple{1, 2, 3} not valid template argument type const triple& because not lvalue. we can't specify triple in template value, because that's disallowed. however, fail understand real problem small line of code. what's reasoning behind not

apache - Htaccess redirection -

this question has answer here: htaccess mod_rewrite [closed] 2 answers how can redirect using htacces from: http://www.example.com/directory/wp-login.php?action=register to: http://www.example.com/sitemap.html you'll need use rewrite condition match against %{query_string} variable (which action=register in example), , match against uri in rewrite rule (which directory/wp-login.php in example). it's pretty straightforward. rewriteengine on rewritecond %{query_string} ^action=register(&|$) rewriterule ^directory/wp-login\.php$ /sitemap.html? [l,r=301] these in htaccess file in document root, preferably before rules may have in there.

ajax - trigger.io: tabs.openWithOptions causes application to crash in Android -

we using tabs in calling authentication our mobile application. seems working before now, after toolkit updated, causing crash our application. you can see code if problem: $(".share_now").live('click' , function(){ authorize_twitter(); }) function authorize_twitter(){ var url_encode="http://server.com/twitteroauth/login.php"; forge.tabs.openwithoptions({ tint:[217, 0, 0, 87], url: url_encode, pattern: "http://server.com/twitteroauth/complete/*", title: 'login twitter' }, function (data) { forge.logging.log(data); }); } this error of crash: error crash android 2.2 http://content.screencast.com/users/junnel1001/folders/jing/media/27304ddc-7094-4006-b457-f9de09398026/sample.png i hope trigger.io can issue. thanks. my apologies - caused fix went in while ago getting lost in merge v1.4.37: i've pushed v1.4.40 addresses that!

android - Turn on Packet Data in dual sim phone -

i'm using function turning on packet data: public static void setdatanetworkenable(context mcontext) { try { connectivitymanager conman = (connectivitymanager) mcontext .getsystemservice(context.connectivity_service); class<?> conmanclass = class.forname(conman.getclass().getname()); field iconnectivitymanagerfield = conmanclass .getdeclaredfield("mservice"); iconnectivitymanagerfield.setaccessible(true); object iconnectivitymanager = iconnectivitymanagerfield.get(conman); class<?> iconnectivitymanagerclass = class .forname(iconnectivitymanager.getclass().getname()); method setmobiledataenabledmethod = iconnectivitymanagerclass .getdeclaredmethod("setmobiledataenabled", boolean.type); setmobiledataenabledmethod.setaccessible(true); setmobiledataenabledmethod.invoke(iconnectivitymanager, true); } catch

r - Error ggplot (Error in seq.int(0, to0 - from, by) : 'to' must be finite) -

Image
for plotting data ggplot2 , have faced following error. commands, data , error types available following: require(ggplot2) require(reshape2) df <- data.frame(hmn25_30$avg,dt_hmn$dt) df[3] = c( "normal", "normal", "normal", "normal", "normal", "normal", "normal", "normal", "normal", "normal", "outlier", "outlier", "outlier", "outlier", "outlier", "outlier", "normal", "outlier", "outlier", "normal", "normal", "outlier", "outlier", "normal", &quo

javascript - jQuery doesn't rotate images -

i'm trying use datalist fetch image fro list >>> , jquery rotate image jquery doesn't rotate images .... 1 tell me what's wrong on code <script type="text/javascript"> var activenewitem = 0; $(function () { var totalitems = $("#myrotator li").length; $("#myrotator li").hide(); $("#myrotator li::nth-child(" + ((activenewitem++ % totalitems) + 1) + ")").show(); settimeout('rotatewhatsnew()', 5000); //30000 }); </script> <asp:datalist id="rotator" bordercolor="black" cellpadding="2" headerstyle-backcolor="darkblue" headerstyle-forecolor="yellow" repeatcolumns="1" runat="server" height="179px" width="168px"> <headerstyle backcolor="darkblue" forecolor="yellow"></headerstyle> <

visual studio - compare argv[1][i] arrays C++ -

i need compare arrays in argument can tell me why part of code wrong { for(int i=0;i<strlen(argv[3]);i++) if(strcmp((argv[3][i]),"c")==0){ cout<<"c"<<endl; return (0); } thanks..... if(strcmp((argv[3][i]),"c")==0) this line wrong. argv[3][i] character, not string. want : if(argv[3][i]=='c')

java - File getting truncated while conversion -

when converting folder many files ansi(windows-1252) utf8, of files getting truncated while file small size blank. tried converting files reducing buffer size, didn't succeed. 1 has any idea on this??? public class convertfromansitoutf8 { private static final char byte_order_mark = '\ufeff'; private static final string ansi_code = "windows-1252"; private static final string utf_code = "utf8"; private static final charset ansi_charset = charset.forname(ansi_code); public static void main(string[] args) { list<file> filelist; file inputfolder = new file(args[0]); if (!inputfolder.isdirectory()) { return; } file parentdir = new file(inputfolder.getparent() + "\\" + inputfolder.getname() + "_converted"); if (parentdir.exists()) { return; } if (parentdir.mkdir()) { } else { return; } filelist = new arraylist<file>(); (final file fileentry : inputfolder.listfiles()) { filelist.add(file

mysql - Cannot modify an external database in Joomla! 3.0.3. using php request -

i have been creating website on local server joomla! 3.0.3. have connected external database website , can query (see previous question of mine: where statement not working in joomla! 3.0.3. php request ). when try modify entry in external database, server returns error screen. here's code i'm using in end of joomla! (using sourcerer extension). try add new currency mysql "currency" table in external database. <?php /**///////// load external database (i.e. not joomla one) /////////**/ $option = array(); $option['driver'] = 'mysql'; // database driver name $option['host'] = 'localhost'; // database host name $option['user'] = 'root'; // user database authentication $option['password'] = ''; // password database authentication $option['database'] = 'externaldatabase'; // database name $db = jdatabase::getinstance( $option ); /**///////// create new query object /////////**/ $q

android - Loader unable to retain itself during certain configuration change -

according http://developer.android.com/guide/components/loaders.html , 1 of nice thing loader that, able retain data during configuration change. they automatically reconnect last loader's cursor when being recreated after configuration change. thus, don't need re-query data. however, doesn't work in scenarios. i take following simple example. fragmentactivity , hosting fragment . fragment owns asynctaskloader . the following 3 scenarios work pretty well. during first launched (ok) 1 loader created, , loadinbackground executed once. during simple rotation (ok) no new loader being created , loadinbackground not being triggered. a child activity launched, , button pressed (ok) no new loader being created , loadinbackground not being triggered. however, in following scenario. a child activity launched -> rotation -> button pressed (wrong) at time, old loader's onreset called. old loader destroyed. new loader created , new l

jquery-datatables-rails bootstrap styling -

Image
in rails using bootstrap , datatables via jquery-datatables-rails gem. however, seem half bootstrap styling. gem 'jquery-datatables-rails', git: 'git://github.com/rweng/jquery-datatables-rails.git' application.js //= require jquery //= require jquery_ujs //= require jquery.ui.core //= require jquery.ui.datepicker //= require twitter/bootstrap //= require datatables/jquery.datatables //= require datatables/jquery.datatables.bootstrap //= require datatables/extras/tabletools //= require chosen-jquery //= require best_in_place //= require cocoon //= require_tree . $.extend( $.fn.datatableext.ostdclasses, { "swrapper": "datatables_wrapper form-inline" } ); application.css *= require_self *= require jquery.ui.core *= require jquery.ui.datepicker *= require datatables/jquery.datatables.bootstrap *= require datatables/extras/tabletools *= require datatables/extras/tabletools_

mongodb cant drop index after stopping indexing -

i had run index on mongodb did db.devices.ensureindex({ "installed_packages" : 1 }) but when ran, noticed large , dont have time it, stopped indexing. now, need run db.devices.reindex() but tries again index on installed_packages i dont need anymore, , when try run db.devices.dropindex({ "installed_packages" : 1 }) it says : { "errmsg" : "can't find index key:{ installed_packages: 1.0 }", "ok" : 0 } and if run: db.devices.dropindex("installed_packages_1") it says: { "errmsg" : "index not found", "ok" : 0 } what can drop it?