Posts

Showing posts from April, 2013

c# - WPF get inserted inline from applypropertyvalue -

i have richtextbox (currichtextcontrol) , change textdecoration of selected text: textrange range = new textrange(currichtextcontrol.selection.start, currichtextcontrol.selection.end); textdecorationcollection tdc; tdc = textdecorations.overline; range.applypropertyvalue(inline.textdecorationsproperty, tdc); wpf ist going create new inline that. lets paragraph containing range consists of 1 inline (or run) prior applying textdecoration. going result in 3 inline elements after that. how can new inline overline? applypropertyvalue not return value or object. have search paragraph manually? thank you!

How to put a NSDate Object into sqlite -

i read posts topic, nothing solved problem. have following lines of code. nsdate *today = [nsdate date]; nslog(@"today: %@", today); self.person.dayofbirth = today; nslog(@"birth: %@", self.person.dayofbirth); [appdelegate savecontext]; the nslog-statements tell me right result expected. , result stored in database. when @ cell in sqlite manager, there value this: 399911663.291896 think timestamp cuz column's type "timestamp"... dot strange. dont know how right date in sqlite db. can me please? i think nsdate stored in nsmanagedobjects sqlite db nstimeinterval double (the seconds since 1970). have problems date different when read objects out of db?

c# - How to bind to WPF View with two objects in a Many to Many Relationship? -

given have many many relationship in data access layer (using codefirst - ef) e.g. public class report{ public int reportid {get;set;} public string reportname {get;set;} public list<reportkeyword> reportkeywords {get;set;} } public class reportkeyword{ public int reportid {get;set;} public int keywordid {get;set;} } public class keyword{ public int keywordid {get;set;} public string keywordname {get;set;} public list<reportkeyword> reportkeywords {get;set;} } i need create user interface (wpf view) displays listview of reports , each report should display child list view of keywords. therefore can done in viewmodel best way of modelling viewmodel purpose. need create vm necessary properties? reportviewmodel similar properties want display off report object, including collection of keywords. public class reportviewmodel : viewmodelbase<reportviewmodel> { private string _reportname; public string reportname { { re

c# - is window.external synchronous or not -

i have discovered window.external object allows call c# function in winform program hosting ie-like browser. i red doc on msdn , threads on stackoverflow didn't found if calls synchronous or not, and, customable ? the thing have founded in msdn doc doesn't speak subject =/ these calls naturally synchronous, makes sense process them asynchronously, avoid otherwise possible reentrancy javascript code. use synchronizationcontext.post that. e.g. call window.external.testmethod() javascript. on .net side may this: this.webbrowser.objectforscripting = new objectforscripting(this.webbrowser); // ... [comvisible(true), classinterface(classinterfacetype.none)] public class objectforscripting { webbrowser _browser; synchronizationcontext _context = synchronizationcontext.current; public objectforscripting(webbrowser browser) { _browser = browser; } public void testmethod() { _context.post(_ => {

How to select rows inside a CLR stored procedure in MS SQL Server 2008? -

following along example found on internet, wrote following c# code implements clr stored procedure in ms sql server 2008: public class class1 { [microsoft.sqlserver.server.sqlprocedure] public static void countstringlength(string inputstring) { sqlcontext.pipe.send(inputstring.length.tostring()); } } this procedure takes string parameter , outputs number of characters in string. i have been working on code retrieves data sql; there's nothing special way data retrieved: makes connection sql server, selects data, , closes connection. want make code run inside stored procedure or trigger on sql server. i suppose make code run same existing sql code: make connection sql server, select data, , close connection. however, doesn't make sense once code running on sql server itself! why want code runs on sql server make server connect itself?!?! is there best practice i'm trying do? can select rows in code using same connection us

Python __file__ variable returns 'encoding error' -

so script in folder contains cyrillic symbols in path , __file__ variabale returns "encoding error" instead of real path. adding following line doesnt help # -*- coding: cp1252 -*- what should do? version of python 3.3 i'm not sure if answers question, but... in python3 __file__ holds current running script , path str . *nix systems use binary filenames , have no preference particular encoding. when use __file__ system attempt take binary string , encode string using default encoding system. i'm wondering if maybe filenames in cp1252 , python trying interpret utf8. python may follow convention outlined here when encoding __file__ : http://docs.python.org/2/library/sys.html#sys.getfilesystemencoding you didn't state os you're using, though...

iis - Fatal error: Class 'COM' not found PHP in Win Server 2008 R2 -

i have installed required libraries like [com_dot_net] extension=php_com_dotnet.dll and restarted iis , still cannot make work? clues keep getting error: fatal error: class 'com' not found in many thanks make sure enabled in iis iis manager -> php manager -> php extensions -> enable or disable extensions also make sure dll file in ext folder of php installation

ruby on rails - File upload field causing ActionController::InvalidAuthenticityToken exception -

using rails 4, , trying add file field existing form, using simple_form , paperclip. here's critical part of form: <%= simple_form_for(@employee, html: { class: 'form-horizontal requires', multipart: true}, remote: true) |f| %> <%= f.input :avatar %> <% end %> everything works ok, unless submit form uploaded file. then, this: actioncontroller::invalidauthenticitytoken in employeescontroller#update what doing wrong here? the simplest solution add authenticity_token: true form. this: <%= form_for @employee, html: { class: 'form-horizontal requires'}, multipart: true, remote: true, authenticity_token: true |f| %> <%= f.input :avatar %> <% end %>

iphone - iOS Storyboard Modal Segues and Memory -

my apps "short" description: basically interactive storybook, have class sets audio session , audio player every other class(viewcontrollers) in app imports , calls function or 2 set right sound played each time happens(for instance.. user reads story). each viewcontroller has it's own .m , .h classes , uses them animations , action handling. app 60 mb's in size (audio/images/code). now these viewcontrollers set in storyboard (they 13 now) , modal segued 1 next 1 , programmatically dismissed go back. when run app on ipad now, i'm starting memory warnings , yes instruments showing me app adding 40 mb's every viewcontroller segue to. my questions are: do reside in real memory no matter do? (i thought wasn't holding strong pointers these view controllers). is there easy way me dismiss 1 controller , still use modal segue next one?(ran troubles trying this) modal segues not way should doing things in app they?!. looked nice , easy "storyb

python - How to customize a django form (adding multiple columns) -

currently, building form using default django template this: class old_form(forms.form): row_1 = forms.floatfield(label='row 1') row_2_col_1 = forms.floatfield(label='row 2_1') row_2_col_2 = forms.floatfield(label='row 2_2') html = str(old_form()) however, add multiple columns template, , still use django forms object define parameters. new temp. should (or can loop through variables): def getdjtemplate(): dj_template =""" <table> <tr>{{ table.row_1 }}</tr> <tr> <td>{{ table.row_2_col_1 }}</td> <td>{{ table.row_2_col_2 }}</td> </tr> """ return dj_template djtemplate = getdjtemplate() newtmpl = template(djtemplate) my question how 'combine' new template , class old_form() ? thanks help! you can customize form html using fields, as shown in documentation . doing in unusual way; have template in f

Excel VBA - Graph Update Loop -

having trouble below code i've written. should updating entries of graph ran dl5:hx5 dl5:iu5, have around 100 sheets hence loop. reason it's stepping through appear have semantic error. hoping might shed light was. there 3 figures, , i'm not sure best way access figures on multiple sheets (they're identical copies of 1 another, different data.) first 2 extends time series additional columns (e.g. hx iu), last figure color formats line different color (the line split projected , actual line fragments.) dim integer = 31 activeworkbook.worksheets.count on error resume next worksheets(i).chartobjects("chart 2").activate activechart.seriescollection(1).values = "='" & worksheets(i).name & "'!$dl$5:$iu$5" activechart.seriescollection(1).xvalues = "='" & worksheets(i).name & "'!$dl$3:$iu$3" worksheets(i).chartobjects("chart 6").activate activechart.seriescollection(1).values

javascript - backgroundSize "cover" not working on Firefox -

this question has answer here: why doesn't -moz-background-size:cover work in firefox? 1 answer i using following load ramdom background image each time browser refreshed. on top use 2 z-layers fade in, 1 black trasparent , overlay pattern transparent solid. works fine on chrome , safari firefox refuses fade out layer no1 (black transpartent), , firefox refuses strech images cover background. <script type="text/javascript"> var totalcount = 6; function changeit() { var num = math.ceil( math.random() * totalcount ); document.body.background = 'images/'+num+'.jpg'; document.body.style.backgroundsize = "cover"; document.body.style.backgroundposition = "center"; } </script> </head> <body style="background-color:#000"> <a style="display:block; position:fixed; left:0; top:0;

javascript - ReferenceError: Invalid left-hand side in assignment -

my code rock paper scissors game (called toss) follows: var toss = function (one,two) { if(one = "rock" && 2 = "rock") { console.log("tie! try again!"); } // more similar conditions `else if` }; when enter in parameters toss("rock","rock") i error code: "referenceerror: invalid left-hand side in assignment" how fix it? error means , other cases when error can happen? you have use == compare (or === , if want compare types). single = assignment. if (one == 'rock' && 2 == 'rock') { console.log('tie! try again!'); }

c++ - Pop up menu event control in Qt -

when add pop menu in qt follows: qmenu menu(widget); menu.addaction("aaa"); menu.exec(eventpress->globalpos()); how control "aaa" action events. e.g. when "aaa" clicked. you can overloaded addaction. from qt assistant convenience function creates new action text text , optional shortcut shortcut. action's triggered() signal connected receiver's member slot. function adds newly created action menu's list of actions , returns it. myclass::popup() { qmenu menu(widget); menu.addaction("aaa", this, slot(burncase())); menu.exec(eventpress->globalpos()); } // slot myclass::burncase() { }

sql - Why does this simple MySQL query not return the row? -

i have row in table users username test . reason, though, query returns empty result set. select `id` `users` `username` = "test" , `id` != null; however, if remove `id` != null segment, query returns result id = 1 . but 1 != null . how happening? the id field non-nullable , auto-increment. thanks! the query doesn't return row because predicate " id != null " never return true. th reason boolean logic in sql 3 valued. boolean can have values of true , false or null . and inequality comparison return null whenever 1 (or both) of values being compared null . the sql standard means compare null use id null or id not null . mysql adds convenient null-safe comparison operator return true or false: col <=> null . or, in case not (col <=> null)

wordpress - WooCommerce Template Override for Archive-Product.php (Main Shop Page) Not Working -

i can't life of me manage override main shop page. my understanding it's archive-product.php i've attempted copy woocommerce directory created in theme's root directory , modify it. no dice. i've attempted modify directly in woocommerce plugin directory. no dice there either. i've gone far adding underscore before archive-product.php file name in both locations (woocommerce directory , theme template directory) in attempt break - see if impact change - , doesn't seem have effect either. i'm not running cache plugins , every other woocommerce template file i've attempted modify until point has worked fine. any ideas? you doing correctly. you'll have double check locations per: shop template in plugins/woocommerce/templates/archive-product.php you can copy my-themes/woocommerce/archive-product.php override core woocommerce file.

mongodb - Multiple indexes on a single @Property? -

i have simple morphia @entity date property defined. i'd have 2 indexes on property: 1 ascending order, , descending order. however, when add @indexed annotation property, error saying cannot have duplicate annotation on field. there way accomplish this? better way? you need 1 index. sorting should use index either way.

c# - CI Build on TeamCity Fails due to dependency on Microsoft.Bcl -

when try , build project in teamcity (or in clean repository on machine), fails error message the schema version of 'microsoft.bcl' incompatible version 1.7.30402.9028 of nuget. please upgrade nuget latest version <nuget url>... i've set nuget.targets restore packages, , not require user interactions accept licenses. in addition both local machine , build server have restore packages setting enabled (in project/env variable appropriate). i'm aware of issue http://blogs.msdn.com/b/dotnet/archive/2013/06/12/nuget-package-restore-issues.aspx . i've tried second , third options suggested here, without success. does have suggestions how resolve error? turns out version of nuget held in .nuget folder of solution out of date. version visual studio uses had updated correctly, command line version didn't. i followed instructions described here nuget versioning issue package restore resolve problem. in solution directory run these commands:

how to get dictionary value in python from dynamic key -

from xlrd import open_workbook book = open_workbook('trial.xls') sheet=book.sheet_by_index(0) name_email={} i=0 row_index in range(sheet.nrows): if name_email.has_key(sheet.cell(row_index,i).value): name_email[str(sheet.cell(row_index,i).value.strip())]=sheet.cell(row_index,i+1).value,) else: abc = str(sheet.cell(row_index,i).value.strip()) print repr(abc) print '"{0}"'.format(repr(abc)) # print name_email[abc] name_email[str(sheet.cell(row_index,i).value.strip())]=sheet.cell(row_index,i+1).value i+=1 print name_email.keys() print name_email the out put : 'manoj' "'manoj'" 'dibyendu' "'dibyendu'" 'sourav' "'sourav'" ['dibyendu', 'sourav', 'manoj'] {'dibyendu': (u'd.b@gmail.com',), 'sourav': (u's.b@gmail.com'

ruby on rails - rspec, devise, selenium - login in request spec -

i tried follow these steps https://github.com/plataformatec/devise/wiki/how-to:-test-with-capybara don't pass login page. correct me , show i'm doing wrong? rspec require 'spec_helper' include warden::test::helpers warden.test_mode! describe "business::contacts" describe "get /business_contacts", js: true before(:each) @account = create :business_account @account.confirmed_at = time.now @account.save login_as(@account, scope: :account, run_callbacks: false) end > "show page restricted access", slow: true > visit business_contacts_path > save_and_open_page > end factory: factory :business_account, class: 'account' email { faker::internet.email } username { faker::name.name } first_name { faker::name.name } last_name { faker::name.name } password "foaabar123" password_confirmation { |u| u.password } confirmed_at time.now

javascript - Any way to avoid a quick flash of preceding frames when doing a seekTo() a specific time? -

when i'm doing seekto on video quick flash of frames preceding actual time i'm seeking to. if video paused prior seek operation. doesn't smooth, @ least. there way avoid such behavior? can't instantly jump time specified in seekto()? ok, there way - make more key frames per second. , if working series of small clips combined 1 youtube video, put big gaps between them (2 second long each, @ least).

image - How can I open or view a file with extension .bob? -

our interactive development company received assets client extension ".bob". supposed sort of 3d assets, or possibly 3d renders. have no idea how open or view these files. we on osx, if there windows solution, have access well. what program can use these files? the best way deal kind of situations, aside using google or other search engines, ask client program used create these files. a quick google search seems indicate uncommon raytracer bitmap image format. http://www.openwith.org/file-extensions/bob/1134 can opened xnview. more information on it's origin here: http://www.fileformat.info/format/vividbob/egff.htm it mentioned here: http://www.pixedit.com/fileformats.aspx#73862070-8a21-4446-a3f0-f79f57cbbffb .bob files opened , converted pixedit. http://www.pixedit.com/

windows - Printing string text in C does not print -

i trying print specific string line printer. try run snippet nothing prints out. looking @ list of pending jobs printer, , nothing shows when run code. i can print documents fine word, printer available. can hint @ problem may be? #include <stdio.h> #include <stdlib.h> int main() { file* printer = 0; if(( printer = fopen("lpt1", "a+")) == null) { puts("error opening printer"); } char* text = "this test printing"; if ( (fprintf(printer, "%s" , text) ) < 0 ){ perror("printing error"); } fflush(printer); fclose(printer); return 0; } i think misunderstanding code. code submitted writes string "this test printing" file in same directory called "lpt1". what wanting write out "/dev/lpt1", , should able test running echo "this printed text" >/dev/lpt1

java - Servlet Filter not working when exception is thrown -

what trying do? i trying generate new timestamped tokens server side client can use in subsequent request what have tried? i have servlet filter wraps around rest calls , looks like @webfilter(urlpatterns = "/rest/secure") public class securityfilter implements filter { private static final pattern pattern = pattern.compile(":"); private static final logger logger = loggerfactory.getlogger(securityfilter.class); @override public void init(final filterconfig filterconfig) throws servletexception { //logger.info("initializing securityfilter"); } @override public void dofilter(final servletrequest request, final servletresponse response, final filterchain chain) throws ioexception, servletexception { final httpservletresponse httpservletresponse = (httpservletresponse) response; final string authtoken = getauthenticationheadervalue((httpservletrequest) request); try { va

c# - Adding Class Library Reference to WCF Service Library -

i'm working on first web service, , i'm having trouble referencing class library have in solution inside of web service. here service: using mydomain; namespace webservices { public class automatedlogin : iautomatedlogin { public guid gettoken(string email) { //code goes here } } } when add reference mydomain inside wcf service library, intellisense recognizes reference, when rebuild solution, compiler throws following error: the type or namespace name 'mydomain' not found (are missing using directive or assembly reference?) can tell me why compiler ignoring mydomain reference when try rebuild solution? i able find similar question: wcf service library project can't find reference other project i changed project's target framework .net framework 4 client profile .net framework 4 seems have fixed compiling issue.

mysqli - PHP: Trying to get property of non-object -

i working on function, returns whether table exists or not. but notices: notice: trying property of non-object [...] on line 10 in 1 function table_exists($table) { 2 3 // database 4 global $mysqli; 5 6 // tables named $table 7 $result = $mysqli->query("show tables $table"); 8 9 // if result has more 0 rows 10 if($result->num_rows > 0) { 11 return true; 12 } else { 13 return false; 14 } 15 } the $mysqli var set this: $mysqli = new mysqli(mysqli_host, mysqli_user, mysqli_password, mysqli_database); how solve that? your sql syntax wrong. check value of variable $table. should have like show tables "%"

c# - WiX: Install C++ 2005 before Crystal Reports -

using vs 2012 , wix 3.5, trying create wix installer install program have written requires crystal reports (using "sap crystal reports, developer version microsoft visual studio" version 13_0_6). found link explains microsoft visual c++ 2005 merge modules required crystal reports work. i have 2 questions this: 1) using vs 2012 , therefore have vc110_* merge files available me. ok use these merge files or need specific c++ 2005 files? 2) can somehow wix create installer first install c++ files , crystal report files? right getting error referenced in link above means c++ not installed on target machine. here snippet of wix file showing how including merge files: ... <feature id="wpfcrystalreports" title="wpf crystal reports" level="1"> <mergeref id="msvc110crtx86" /> <mergeref id="crystalruntime" /> <componentgroupref id="productcomponents

java - JClouds: BlobStore.getBlob() taking a long time -

i'm using jclouds 1.6.1-incubating in web application (using scala playframework 2.1.3, shouldn't matter). since other methods in jclouds receive blob seem deprecated, want use blobstore.getblob(container,name).getpayload().getinput() to input stream of stored data. want stream data browser without having store whole blob on server. sometimes want metadata like blobstore.getblob(container,name).getmetadata().getcontentmetadata().getcontentlength() however, call to blobstore.getblob(container,name) takes long return (i assume, loads blob memory). causes webapp unresponsive after user clicks "download". i'd cloud data start streaming browser (playframework supports that). when want metadata, timeout worse (i might want metadata many files without downloading of them webapp). am right? blobstore.getblob(container,name) downloading file before returning? there way asynchronous input stream can directly send browser? you can query metad

html - Hover image enlarge using css, in front of other images -

i have table images , have set css enlarge images , display text on hover. i'm having trouble images enlarging in of other images. need hover enlarged image in front of rest. here's fiddle - http://jsfiddle.net/ef5cx/ html: <table width="522" border="0" align="center" cellpadding="0" cellspacing="3"> <tr> <td width="179"><div class="imagewrapper1"><a href="http://cloverparklakes6450.com/events_cocktails.php"><img src="http://cloverparklakes6450.com/images/cocktails.jpg" name="cocktails" width="179" height="265" border="0" align="top" id="cocktails" /></a><a href="http://cloverparklakes6450.com/events_cocktails.php" class="cornerlink">august 22 friday night cocktails @ oakbrook cc</a></div></td> <td colspan="

struts2 - jqgrid with datepicker not show? -

implement datepicker jqgrid , not list when add editoptions. here code jsp //javascript function datepick (elem) { alert("hellow 1"); jquery(elem).datepicker( // {} // options here $(elem).datepicker({dateformat:'yy.mm.dd'}) ); } function dateval(){ var currenttime = new date(); var month = parseint(currenttime.getmonth() + 1); month = month <= 9 ? "0"+month : month; var day = currenttime.getdate(); day = day <= 9 ? "0"+day : day; var year = currenttime.getfullyear(); return year+"-"+month + "-"+day; } //jqgrid <sjg:gridcolumn name="id" index="id" title="id"/><sjg:gridcolumn name="nombre" index="nombre" title="name" sortable="true" search="true" editable="true"/> <sjg:gridcolumn name="fecha" index="fecha" title="fecha" editable="

git - Migrating to NuGet Automatic Package Restore -

i migrating msbuild-integrated package restore automatic package restore became available v2.7 of nuget. steps easy follow confused part mentions .nuget/nuget.config if create new solution few projects, automatic package restore "just works" , there no .nuget folder @ solution level @ all... so why migration doc mention need leave it? works if remove it... i read in docs 1 possible advantage of leaving " using approach, rather cloaking packages folder or otherwise ignoring it, allows nuget skip call visual studio pend changes packages folder. " it? big advantage (as opposed having cleaner solution)? note: using git in tfs , not tvsvc. that nuget.config file team foundation server (tfs). if not using tfs, can safely remove it. quote migrating msbuild-integrated solutions use automatic package restore : by default, nuget.config file instructs nuget bypass adding package binaries source control. automatic package restore honor long lea

jquery ajax call (2) -

can tell me wrong ? <!doctype html> <html> <head> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script> $(document).ready(function() { var url = 'http://www.google.com/ig/calculator?hl=en&q=100inr=?usd'; var title = "jquery"; $.getjson("http://www.google.com/ig/calculator?hl=en&q=100inr=?usd" + "&format=json&callback=?", function(data) { alert(data); }); }); <div id="div1">test page</div> i making call , getting error. know why ? how make ajav calls url http://www.google.com/ig/calculator?hl=en&q=100inr=?usd you can't make ajax calls cross-domain. need use jsonp make work cross-domain. jquery's $.ajax method supports jsonp requests. if google api doesn't support jsonp style responses, out of luck. using proxy, suggest @felixkling, other option.

javascript - Black blocks on Google map API v3 -

Image
i have problems embedded google map. i'm using api v3, , reason black blocks rendered behind map controls , marker. here's screenshot: i have html5 doctors reset stylesheet, , simple custom styling layout , typography. when refresh page whole map blinks moment , black blocks rendered. here's codepen, map not displayed there reason. have marked with: [google map] it's easier find. http://codepen.io/jinx/pen/bcrpn [update] i have created new html without content except map div element , scripts , css files original html included , map works properly. this confuses me because appear bug due html surrounding map? [update2] i got map render on code pen has no controls , no marker. still same result on local version. could because i'm working locally? [update3] i checked in firefox, internet explorer 9, opera , safari , map rendered perfectly. seems chrome bug . also, have noticed chrome offsetting element boxes out of browser window visible

python - Pythonic Name Matching -

i have database names of football teams, (for instance in first entry below, marshall , southern methodist). then, matched database names different, yet recognizable names (in first entry below, smu, marshall): [u'houston', u'alabama'] [u'houst', u'alab'] [u'florida state', u'north carolina state'] [u'ncst', u'flast'] [u'penn state', u'iowa'] [u'pnst', u'iowa'] [u'oklahoma', u'texas'] [u'texas', u'okla'] [u'florida atlantic', u'south florida'] [u'sfla', u'flatl'] [u'georgia', u'tennessee'] [u'geo', u'tenn'] [u'san jose state', u'idaho'] [u'ui', u'sjsu'] [u'washington state', u'arizona state'] [u'arzst', u'wshst'] [u'fresno state', u'nevada'] [u'nevad', u'frsst'] [u'oregon st

Scala Pickling usage MyObject -> Array[Byte] -> MyObject -

i trying new scala pickling library presented @ scaladays 2013: scala pickling what missing simple examples how library used. i understood can pickle object unpickle again that: import scala.pickling._ val pckl = list(1, 2, 3, 4).pickle val lst = pckl.unpickle[list[int]] in example, pckl of type pickle. use of type , how can example array[byte] of it? if want wanted pickle bytes, code this: import scala.pickling._ import binary._ val pckl = list(1, 2, 3, 4).pickle val bytes = pckl.value if wanted json, code exact same minor change of imports: import scala.pickling._ import json._ val pckl = list(1, 2, 3, 4).pickle val json = pckl.value how object pickled depends on import type chose under scala.pickling (being either binary or json ). import binary , value property array[byte] . import json , it's json string .

transformer - Mule returning a MessageCollection from component -

i'm having difficulty returning collection of mulemessage instances component. mule 3.3.1. the following code works (i.e., after component, foreach component logger dumps out "abc" , "def" expect). public object oncall( muleeventcontext eventcontext ) throws exception { mulemessage message = eventcontext.getmessage(); mulemessagecollection collection = new defaultmessagecollection( message.getmulecontext() ); string s1 = "abc"; string s2 = "def"; defaultmulemessage m1 = new defaultmulemessage( s1, message.getmulecontext() ); defaultmulemessage m2 = new defaultmulemessage( s2, message.getmulecontext() ); list<mulemessage> list = new arraylist<mulemessage>(); list.add( m1 ); list.add( m2 ); collection.addmessages( list ); return collection; } if, however, substitute class of own in place of strings, so: public object oncall( muleeventcontext eventcontext ) throws except

ios - Keeping a footer on screen in UICollectionView during an Add -

i have standard flowlayout uicollectionview (scrolling vertically, single section, fixed size items, variable number of columns (e.g. 2 in iphone landscape v 1 in horiz v 3 or 4 on ipad). i'm using nsfetchedresultscontroller manage items displayed core data. i have add button in footer supplementary add new item. when user presses add button, naturally want add item, want add button remain on screen (scrolling if necessary), can press again. i check in additem routine: uicollectionviewlayoutattributes * footerinfo = [self.collectionview layoutattributesforsupplementaryelementofkind:uicollectionelementkindsectionfooter atindexpath:[nsindexpath indexpathforrow:0 insection:0 ]]; [self.collectionview scrollrecttovisible:footerinfo.frame animated:yes]; this works well, except when frc adds item on next runloop, collectionview moves footer down offscreen again. i can't add row of height frame 2 reasons: first, expanded rect isn't on controllerview yet, second: if i

iphone - UIActivity Duplicate Calls to 'activityViewController' -

i have uiactivity implements activityviewcontroller method. works fine, except when user double taps on icon activity. causes duplicate calls method , crashes with: terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'application tried present modally active controller .' i using custom uiactivityitemprovider data makes server call (and can slow) , seems cause of issue. how can make sure 2 view controllers aren't being presented? note: being done through uiactivityviewcontroller don't think have access buttons disable them. disable button after first click, , enable after dismiss activityviewcontroller

java 6 - How to access local system files in jsp with hyperlink -

i developed web application using struts 1.2 , need access local files((c:\testing) in jsp link format.when user clicks on file name automatically opens(no download option).file can of type(pdf,excel,.doc...) tried "><%=filename%> , "><%=filename%> none of them worked..any kind of appreciated. thanks even if html ended correctly formatted link "c:\testing" remote user's browser interpret pointing their local c drive (if have one). instead need implement file download servlet: implementing simple file download servlet and in jsp insert link servlet.

caching - C# - Why is my HTTPWebRequest returning a cached response every time? -

i've seen various similar questions this, nothing has helped solve issue. here's code fragment i'm working: networkcredential credentials = new networkcredential(credentialsmanager.username, credentialsmanager.password); httpwebrequest getreq = (httpwebrequest) webrequest.create(m_editpageurl); getreq.cachepolicy = new requestcachepolicy(requestcachelevel.bypasscache); // i've tried requestcachelevel.nocachenostore getreq.credentials = credentials; getreq.timeout = 1000; getreq.method = "get"; getreq.accept = "text/html"; string responsestring; using (httpwebresponse getresponse = (httpwebresponse) getreq.getresponse()) { using (stream responsestream = getresponse.getresponsestream()) { if (responsestream == null) throw new exception("did not receive response specified page."); using (streamreader reader = new streamreader(responsestream)) responsestring = reader.readtoend(); } }

C# Updating Environment Variable - SendMessageTimeout -

i'm trying set system environment variable, note change reflected i've got sendmessagetimeout update windows. i can run, , return 0 result, environment variable not ever updated. [flags] public enum sendmessagetimeoutflags : uint { smto_normal = 0x0, smto_block = 0x1, smto_abortifhung = 0x2, smto_notimeoutifnothung = 0x8 } [dllimport("user32.dll", setlasterror = true, charset = charset.auto)] public static extern intptr sendmessagetimeout( intptr hwnd, uint msg, uintptr wparam, intptr lparam, sendmessagetimeoutflags fuflags, uint utimeout, out uintptr lpdwresult); string reg_subkey = "test1"; string reg_name = @"hkey_local_machine\system\currentcontrolset\control\session manager\environment"; registry.setvalue(reg_name, reg_subkey, "testing", registryvaluekind.string); intptr hwnd_broadcast = new intptr(0xffff); const uint wm_wininichange = 0x001a; const uint wm_settingchange = wm_wininichange; const int msg_ti

javascript - How to refresh a home page or go to the home page with one link? -

alright here's dilemma, have refresh link on blog refreshes current page you're on. want link to, if you're on homepage ( / ) refresh , if you're on different page, /tagged/me go homepage / current html have links section is: <div id="linkz"> <a href="javascript:history.go(0)" title ="refresh">refresh</a> - <a href="/fask" title="fask">fask</a> - <a href="/tagged/me" title="face">face</a> - <a href="/more" title="more">more</a></div> p.s. blog here , links in sidebar. i'm not sure if question asking if want go home page, set link <a href="/" title="home page">home page</a> on every single page. no need javascript, straight html.

java - How to extract value from a formatted price? -

i regex in java extracts value price. example, $40,250.99 expression output 40250.99. key thing has done regular expressions. cannot string concatenation or other string related manipulations. have tried following "," messes everything. $503.34 yield 503.34 $40,250.99 yields 40 string extractionpattern = "[\\$](\\d+(?:\\.\\d{1,2})?)"; string val = " executive billings @ $40,250.99 starting 2013-01-05 bi weekly"; pattern p = pattern.compile(extractionpattern); matcher m = p.matcher(val); if (m.find()) system.out.println("found match:" + m.group(1)); there better ways , i'll first admit regex pretty basic... string regexp = "\\$[0-9,\\.]+"; string value = "executive billings @ $40,250.99 starting 2013-01-05 bi weekly"; pattern pattern = pattern.compile(regexp); matcher matcher = pattern.matcher(value); // should result in list 1 element of "$40,250.99" list<string> lstmatches = new

jquery draggable / sortable with disabled items -

using include , exclude example, trying make if 2 items excluded , item can't dropped between them. review url; http://jqueryui.com/sortable/#items the top example perfect except item's can't dropped before or after lists (move item 4 top, try , put item 4 back, wont let you). in second example items can put before/after , between disabled items, again half way want. is there way make disabled items can't inserted between? the following fiddle has working example if know disabled options going next each other. adds dropable spot after last disabled spot. fiddle $(function () { $("#sortable1").sortable({ items: "li:not(.ui-state-disabled),li.ui-state-disabled:last-child" }); $("#sortable2").sortable({ cancel: ".ui-state-disabled" }); $("#sortable1 li, #sortable2 li").disableselection(); });

java - Object Array of length 0 but it still contains Info -

below have pasted code have been working on. need target line mixer can't figure out how request 1 line.info[] array. has length of 0 if output string holds single line of information. want cast don't know how properly. thanks, hat package soundconnect; import javax.sound.sampled.audiosystem; import javax.sound.sampled.line; import javax.sound.sampled.lineunavailableexception; import javax.sound.sampled.mixer; public class soundconnect { /** * @param args command line arguments */ public static void main(string[] args) throws lineunavailableexception { mixer.info [] mixes = audiosystem.getmixerinfo(); mixer sys_mix = audiosystem.getmixer(mixes[1]); line.info[] t_nfo = sys_mix.gettargetlineinfo(); line line1 = sys_mix.getline(t_nfo[0]); /* t_nfo has length of 0 has information when output * */ } } when output string, mean you&#

javascript - click a button based on div id and value with a script -

i have following situation. need simulate button click on off value button under div based on id <div id="devicecontrols1"> <button value="off">off</button> <button value="on" class="active">on</button> </div> <div id="devicecontrols2"> <button value="off">off</button> <button value="on" class="active">on</button> </div i know not valid code in other words id like: document.getelementbyid('devicecontrols2').getelementsbyvalue('off').click(); im not sure how use javascript obtain result using javascript, try this: var buttons = document.getelementbyid('devicecontrols2').getelementsbytagname('button'); (var = 0; < buttons.length; i++) { if (buttons[i].value == 'off') { buttons[i].click(); } } using jquery (since have tagged): $('#devicecontrols2'

windows 8 - C# HttpClient weird error -

i have following code runs no issues on windows phone 8, running on windows 8 results in error. error: exception received while submitting payload: @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ system.runtime.compilerservices.taskawaiter`1.getresult() @ fooproject.httphelper.<submitrequesttomobileanalytics>d__a.movenext() in c:\users\foo_000\documents\github\fooproject\httphelper.cs:line 135 inner exception is: @ system.net.connectstream.closeinternal(boolean internalcall, boolean aborting) @ system.net.connectstream.system.net.icloseex.closeex(closeexstate closestate) @ system.net.connectstream.dispose(boolean disposing) @ system.io.stream.close() @ system.net.http.httpclienthandler.<>c__displayclass8.<getrequeststreamcallback>b__6(task task) code: string jsonpayload = "<<<some json payl

c# - Binding to DynamicObjects in XAML in WinRT -

i have observablecollection<dynamic> class , xaml refuses bind properties on contained objects. i know read somewhere xaml supports dynamic , dyanmicobject i'm mightily confused on why not working. other questions, such one, spectacularly un-helpful: can bind against dynamicobject in winrt / windows 8 store apps i error @ runtime (and in designer @ design time when hovering on {binding s): error: bindingexpression path error: 'displayname' property not found on 'premisemetro.light, premisemetro, ... bindingexpression: path='displayname' dataitem='premisemetro.light, premisemetro, ... target element 'windows.ui.xaml.controls.textblock' (name='null'); target property 'text' (type 'string') please help! thanks. a test observableobject class: class light : dynamicobject, inotifypropertychanged { private readonly dictionary<string, object> _properties = new dictionary<string, object>()

matlab - Optimization using ga algorithm -

i need optimization problem using ga algorithm. number of decision variable 3. i.e 3 x 1 matrix. first element 0. keeping reference want optmize other 2 variables. how can task? then use lb = [0,0,0]; ub = [0,8,8]; intcon = [0 2 3];

MySQL SELinux conflict Fedora 19 -

i've installed mysql 5.6 on f19. although installation successful, i'm unable start mysql service. when ran service mysql start it returns following error: starting mysql..the server quit without updating pid file (/var/lib/mysql/sandboxlabs.pid). i disabled selinux (permissive mode), , service started smoothly. did research disabling selinux, , found disabling selinux bad idea. so, there way add custom mysql policy? or should leave selinux permissive mode? the full answer depends on server configuration , how you're using mysql. however, it's feasible modify selinux policy allow mysql run. in cases, sort of operation can performed small number of shell commands. start looking @ /var/log/audit/audit.log. can use audit2allow generate permission-granting policy around log messages themselves. on fedora 19, utility in policycoreutils yum package. the command # grep mysql /var/log/audit/audit.log | audit2allow ...will output policy code