Posts

Showing posts from May, 2014

ruby on rails - Continuous Integration - Running parallel tests suites that require xvfb -

i'm having issues parallel builds running require xvfb server. using headless ruby gem, had sporadic failures when test suites both require capybara-webkit , xvfb server running in parallel. my guess both trying use same display, attempted set different display values , run them in parallel, there still failure. i tried removing headless gem , running test suite with: display=localhost:$display_num.0 xvfb-run bundle exec rake $display_num set bash variable different between 2 test suites. i error: xvfb-run: error: xvfb failed start when run in parallel. any assistance on deciphering great! here gist , need start 1 headless per process. this done features/support/javascript.rb file referenced in gist, relevant section being: # unnecessary on mac if (!os.mac? && !$headless_started) require 'headless' # allow display autopick (by default) # allow each headless destroy_at_exit (by default) # allow each process have own h

c++ - I am trying to make a robust class that can handle any erroneous input. it works fine until the last number in the file -

#ifndef rationalnumber_h #define rationalnumber_h #include<iostream> using namespace std; class rationalnumber { friend ostream &operator<<(ostream &out,rationalnumber &r); friend istream &operator>>(istream &in,rationalnumber &r); private: int numerator; int denominator; public: rationalnumber(int n,int d); rationalnumber(); operator void*(){return (numerator== 0 ? null :this);} }; #endif #include"rationalnumber.h" #include<stdexcept> #include<cmath> rationalnumber::rationalnumber():numerator(1),denominator(1) { } rationalnumber::rationalnumber(int n,int d):numerator(n),denominator(d) { if(denominator==0) throw runtime_error("cant divide zero"); } ostream &operator<<(ostream &out,rationalnumber &r) { if(r.denominator == 1 || r.denominator == -1 && r.numerator !=0) { if(r.denominator<0 &&a

objective c - UIScrollView like Stocks-Widget -

i did research , did find things they're not i'm looking for. want make uiscrollview looks, feels , works exact stocks widget apple in notifications center. need looping uiscrollview able scroll automatically. of course on own think has done better. of course there persons here asked already, there isn't solution. want know whether there up-to-date , solution. some hints, repos? thank you, jan galler

javascript - How to swap two sets of rows in a table -

i have 2 sets of rows in table selected: var slice1 = $( table ).children( "tr" ).slice( - rowsperitem, ); var slice2 = $( table ).children( "tr" ).slice( i, + rowsperitem ); which can highlight using css , verify correct rows. want swap position in parent table set. 2 sets 1 after other in table , contain same number of rows. everything i've tried moves 1 row: $( slice1 ).after( slice2[slice2.length-1] ); how keep sets or rows together, in same order, swap position in table? here's example of i'm seeing: http://jsfiddle.net/5vbfa/ try using insertafter method: $("#swapbutton").click(function () { var = 2; var rowsperitem = 2; var $tr = $("#thetable").find('tr'); var $slice1 = $tr.slice(i - rowsperitem, i); var $slice2 = $tr.slice(i, + rowsperitem); $slice1.insertafter($slice2[$slice2.length - 1]); }); http://jsfiddle.net/p2vsk/1/

command line - Pass argument to mysql script from mysql client -

is there way/workaround/hack pass argument mysql script? let's have file name myqueries.sql looks this select * foobar id = <arg>; then in mysql command, know can call script by mysql>source myqueries.sql but there way pass argument here? this: mysql>source myqueries.sql 2 then i'd tuple id = 2. myqueries.sql select * foobar id = @arg; on mysql set @arg=2; source myqueries.sql

c# - Only loading and unloading data based on what's visible in a VirtualObjectListView, using ObjectListView? -

i'm writing video manager in c# using objectlistview , preview images generated, saved, , entry put sqlite db. there, use virtualobjectlistview component display entries (including first image preview) in details mode. the problem i've ran several hundred+ entries, starts eat ram , i'm seeing a lot of files (lots of duplicates too) open/locked in process explorer. so, i've attempted implement caching system - 30 images loaded @ time, , ones not needed unloaded while new ones loaded. it doesn't work. ends loading multiple copies of each file somehow, , feels... hacky. i've spent past few days looking event or can bind method to, - can't, i've had use getnthobject in abstractvirtuallistdatasource . anyways, here's code: public override object getnthobject(int n) { videoinfo p = (videoinfo)this.objects[n % this.objects.count]; p.id = n; int storebufferhalf = 5; int storefrom = (n - storebufferhalf < 0) ? 0 : n - storeb

regex - Javascript RegExp Producing Unusual Results with Global Modifer -

this question has answer here: why `pattern.test(name)` opposite results on consecutive calls [duplicate] 4 answers i able work around issue turned out didn't need /g. wondering if able explain why following behavior occurred. x = regexp( "w", "gi" ) x.test( "women" ) = true x.test( "women" ) = false it continue alternate between true , false when evaluating expression. issue because using same compiled regexp on list of strings, leading evaluate false when should have been true. when use g flag, regex stores end position of match in lastindex property. next time call of test() , exec() , or match() , regex start index in string try , find match. when no match found, return null, , lastindex reset 0. why test kept alternating. match w , , lastindex set 1. next time called it, null returned, , last

java - Posting data to new Google Forms -

with previous(legacy) version of google forms possible programatically post data form sending httppost url this: https://spreadsheets.google.com/formresponse?formkey=[key] and data this: entry.1.single=data&entry.2.single=moredata with new version of google forms (released jan 2013 think) url structure different. here snippet "view live form page" <form action="https://docs.google.com/forms/d/1ee330gpkmhx_0dkwmjb6zpdm4fbhhqjsqbbgysetq6m/formresponse" method="post" ... <input type="text" name="entry.1566150510" from code snippet think post url this: https://docs.google.com/forms/d/[key]/formresponse with data this: entry.1566150510=data but i've tried java(android) this: public void postdata() { // create new httpclient , post header httpclient httpclient = new defaulthttpclient(); log.i(mytag, "inside postdata()"); string fullurl = "https://docs.google.com/forms/d/1

html - Table row span cell span -

this assignment need with. hate tables is, says: "the first row in each table consists of 1 table cell spans 2 columns contain real estate listing name. second row in each table consists of 2 table cells." my code: <table> <tr> <th> <h3>test</h3> </th> </tr> <th rowspan="2"></th> <td>something here !</td> </tr> </table> just wanted verify if did correctly? here's full code: http://jsfiddle.net/4jzuc/ also, it's supposed this: http://screencloud.net/v/aa5y you want span column, not row ( colspan vs rowspan ). think looking for. <table> <tr> <th colspan="2"> title </th> </tr> <tr> <td>first cell</td> </tr> <tr> <td>second cell</td> </tr> &l

ios - Setting UIImageView.frame causes EXC_BAD_ACCESS occasionally -

i'm getting exc_bad_access. i've tried suggestions regarding bad access without luck. know caused when set uiimageview frame. this code... _backimageview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"cardback_brothers_royal"]]; cgrect imageframe = _backimageview.frame; imageframe.origin.x = -9; imageframe.origin.y = -9; imageframe.size.width = 151; imageframe.size.height = 225; _backimageview.frame = imageframe; backtrace: 0 0x33cf3a22 in -[uiview(calayerdelegate) actionforlayer:forkey:] () 1 0x33aa201e in -[calayer actionforkey:] () 2 0x33aa1fce in actionforkey(calayer*, ca::transaction*, nsstring*) () 3 0x33aa1eba in ca::layer::begin_change(ca::transaction*, unsigned int, objc_object*&) () 4 0x33a9d9e6 in ca::layer::set_position(ca::vec2<double> const&, bool) () 5 0x33a9d8a2 in -[calayer setposition:] () 6 0x33a9d832 in -[calayer setframe:] () 7 0x33cf2aec in -[uiview(geometry) setframe:] () 8 0x33cf2814 in -

windows - C# audio output without a stream or buffer -

i'm working on program want have audio output. use system.media.soundplayer, except data generated dynamically , in real time. want set speaker single byte value, , change value when needed. buffers or streams make overly complicated. you can't. system.media.soundplayer works on streams, either dynamically generated want or generated file. learn work streams. they're not complicated. less complicated dynamically generating audio.

javascript - Display different scenes sharing resources on multiple canvases -

i'm using three.js create interactive web application, , i've run little stumbling block: i have number of canvases contained in draggable divs on page. in each canvas hope display unlit 3d object different material applied (each material using custom shaders). of materials work off same texture (one might blue-tinted, 1 might desaturated, etc.). the number of canvases on page can vary, expect number commonly reach/exceed 20 canvases, , such sharing resources (particularly large textures) beneficial. up until have been using multiple renderers, cameras , scenes has worked fine until started trying use same texture in multiple scenes. most of materials share uniforms , attributes avoid having duplicate information, , of materials stay in sync 1 (e.g. when of materials change on time should change in same way). i wondering if there way able share textures between scenes/renderers/canvases? when try following error: webgl: invalid_operation: bindtexture: object not

uitableview - Search Display Controller tableview -

i have search bar , search display controller dragged objects list on right of interface builder. placed object on detailviewcontroller's view. set delegate detailviewcontroller. have code in detailviewcontroller supply nsarray of searched results tableview shows when text typed in search bar. basically, search bar on top of detailview of master/detail view.... everything working fine except how access tableview can graphically design tableview , cells in interface builder storyboard? as possible avoid designing views programmatically. the search display controller's table view doesn't exist until app runs , search takes place! there's nothing design until then. can't set search display controller's searchresultstableview ; can read it, you'll have in code.

swing - GUI Issue with JTextField & RMI Java -

i'm having strange issue using tables rmi. client implementation of time slot booking system, i've implemented table. i'm faced 2 problems. first 1 causing table update after change had been made. solution seemed private void cleanup() { panel.removeall(); panel.setvisible(false); panel.revalidate(); showtable(); } and appear working. (or maybe causing issue, i'm not sure) the problem have jtextfield inside method calls actual booking. private jtextfield txtclientname; txtclientname = new jtextfield(); txtclientname.settext("clientname"); and in confirm button listener - callbookingslot(buttonaction, txtclientname.gettext()); the strange thing works initially, once. working mean putting correct value extracted jtextfield table. first time round put in value of user typed in field. subsequent goes , put in string "clientname" anyone have ideas? issue doesn't appear rmi related, i've tried without r

asynchronous - F# using Async.Parallel to run 2 tasks in parallel -

assuming have these 2 functions: let dowork n = async { printfn "work %d" n } let work = async { do! async.sleep(2000) printfn "work finished %d" } how use async.parallel run them concurrently , wait both finish before proceeding? async.parallel takes sequence of async. in case pass list. [dowork 1; work 2] |> async.parallel |> async.runsynchronously |> ignore if want return different types of data use discriminated union . type workresults = | dowork of int | work of float32 let dowork n = async { printfn "work %d" n return dowork(n) } let work = async { do! async.sleep(2000) printfn "work finished %d" return work(float32 / 4.0f) } [dowork 1; work 2] |> async.parallel |> async.runsynchronously |> printf "%a" output work 1 work finished 2 [|dowork 1; work 0.5f|]

ios - A faster way to create complex UIView? -

i have complex view, let's complexview , consists of 10 labels, 2 buttons, 2 large images , need create many times (scrolling, fast scrolling!) - texts , images different in 2 different complexview views. currently creating each complexview instance programmatically. 1) wonder if there techniques speed process of creating uiview each time? 2) option see experiment: create xib-file particular view , extract generic part of view there - benefit that? update: similar question detailed explanation of seamus campbell said here in accepted answer: how reuse/recycle custom element uitableviewcell does? the best way achieve high performance displaying complex views take uitableview approach , re-use offscreen views rather creating new ones. simplest way use table view , custom cells, it's possible roll-your-own if table view's assumptions don't make sense.

javascript - replace method not working -

i'm trying write credit card validation script using luhn algorithm, can't manipulate string input right myself started. trying take out hyphens , spaces string keeps saying in debugger function has no replace method? im not programmer, trying through class..... here's code, there might line or 2 in there testing purposes forgot remove. <script type="text/javascript"> function fixstring(){ //get credit card number var ccnumber = document.getelementbyid("ccnumber"); //remove hyphens , spaces var ccnumber = ccnumber.replace(/-/g, ""); //.replace(/\n/g, ""); show.innerhtml = ccnumber.value; } </script> <body> <form action="#"> <p><label>enter credit card number here:<input id="ccnumber" type="text"> </label> <input value="validate" onclick="fixstring()" type="button"> &l

iphone - Custom Link in UIWebView Bug -

i have uiwebview custom link similar instagram's @username mentions. when link held down, apple's default dialog box pops up, asking open link. how prevent this? this default behavior long press on link, system wide. i don't believe developer can change this.

Error opening sublimetext2 -

when open sublimetext2 following 2 messages: error trying parse settings: no data in ~/library/application support/sublime text 2/packages/user/json.sublime-settings :1:1 error trying parse settings: expected value in ~/library/application support/sublime text 2/packages/user/sftp.sublime-settings :1:1 the json file not exist, while sftp does. how create file, or can find it? saw similar question on here, had file in question, not. appreciate help. add code sublime text > preferences > settings - more > syntax specific - user { "draw_centered": true, // centers column in window "draw_indent_guides": false, "font_size": 12, "trim_trailing_white_space_on_save": false, "word_wrap": true, "wrap_width": 80 // sets # of characters per line } thanks - if possible set values according it.

c# - Trying to read web.config file for an IIS site from a Windows service -

i trying special web.config file web site installed on local iis. search windows service. following: using (servermanager servermanager = new servermanager()) { (int r = 0; r < servermanager.sites.count; r++) { string strsitename = servermanager.sites[r].name; applicationcollection arrapps = servermanager.sites[r].applications; (int = 0; < arrapps.count; a++) { microsoft.web.administration.application aa = arrapps[a]; foreach (virtualdirectory vd2 in aa.virtualdirectories) { string strphyspath = environment.expandenvironmentvariables(vd2.physicalpath); int rr = 0; try { configuration cnfg = servermanager.getwebconfiguration(strsitename, strphyspath); if (cnfg != null) { string swww = getwebconfiggeneralparamvalue(cnfg, "specnodename");

Finding MAX of numbers without conditional IF statements c++ -

this question has answer here: mathematically find max value without conditional comparison 14 answers so have 2 numbers user input, , find max of 2 numbers without using if statements. the class beginner class, , have use know. kinda worked out, works if numbers inputted max number first. #include <iostream> using namespace std; int main() { int x = 0, y = 0, max = 0; int smallest, largest; cout << "please enter 2 integer numbers, , show 1 larger: "; cin >> x >> y; smallest = (x < y == 1) + (x - 1); smallest = (y < x == 1) + (y - 1); largest = (x < y == 1) + (y - 1); largest = (y > x == 1) + (x + 1 - 1); cout << "smallest: " << smallest << endl; cout << "largest: " << largest << endl; return 0; } thats have far, after putting different test data

c# - How do I kill a process, given the title of a form hosted in that process? -

how kill process, given title of form hosted in process? how kill program runs system retired. while had title of it? i believe trying close form. if can use application.openforms property , form based on title like: var form = application.openforms .cast<form>() .firstordefault(r=> r.text == "yourtitle"); if(form != null) form.close(); you should consider there multiple forms same title.

android - TextView pushes buttons off screen with HorizontalScrollView -

i aiming layout similar native calculator app. want text trail off left of screen without moving buttons on right. text moves left until filling screen @ point buttons pushed off right edge. <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:layout_weight="1" android:gravity="right" android:orientation="horizontal" > <horizontalscrollview android:layout_width="wrap_content" android:layout_height="wrap_content" android:scrollbars="none" > <textview android:id="@+id/display_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleline="true" android:textcolor="@android:color/white" android:t

css - Problems with my adaptive video div -

basically trying achieve video fills div, when window size reduced of mobile resize smaller in div. however, original video way larger div need resize it. if put video 100% width effects smaller video doesn't switch when window made smaller, think need max width on video perhaps? ive tried , not altering size @ all. my structure im not super advanced @ html/css yet please keep basic :) many thanks. <div id="video_1"> <video id='myvideo'controls > <source src="video/small.mp4" type="video/mp4" media="all , (max-width: 480px), , (max-device-width: 480px)"> <source src="video/small.webm" type="video/webm" media="all , (max-width: 480px), , (max-device-width: 480px)"> <source src="video/small.ogv" type="video/ogg" media="all , (max-width: 480px), , (max-device-width: 480px)"> <source src="video/large.mp4&quo

Running jQuery inside $(window).load() function but not inside $(document).ready function -

i have existing function icons in web page using jquery ui position plugin: <script type='text/javascript'> jquery( document ).ready( function( $ ) { var element_selector='.test'; if ( $(element_selector).length !== 0) { //jquery ui position code here } }); </script> this function found near footer section of html although in places outputs on head section. suggested me load jquery inside $(window).load() function. reason $(document).ready event fired when dom loaded, it’s fired when document structure ready, before images loaded. $(window).load() event fired after whole content loaded. .position() method might not calculate correct position when it’s fired (before images loaded). if true, how revise above load in $(window).load(). thanks. update : have changed from: jquery( document ).ready( function( $ ) { to this: jquery(window).load(function($) { and error in console: uncaught typeerror: object not function it fails on line

performance - How to efficiently display a large number of moving points -

i have large array of points, updates dynamically. part, (relatively small) parts of array updated. goal of program build , display picture using these points. if build picture directly points 8192 x 8192 pixels in size. believe optimization reduce array in size. application has 2 screen areas (the 1 magnification/zooming in of other). additionally need pan picture in either of screen areas. my approach optimization follows. take source array of points , reduce scaling factor first screen area same second area, larger scaling factor render there 2 arrays in 2 fbos using fbos textures (to provide ability pan picture) when updating picture re-render changed area. suggest ways speed current implementation runs extremely slow. you hardly able optimize lot if don't have hardware run @ adequate rate. if render in different threads fbos , compose result, bottleneck remain. 67 million data points nothing sneeze at, modern gpus. try not update unnecessarily, upd

php - Only allow logged in WordPress Admin to access page (outside of WordPress core) -

background on trying accomplish... have created mini cms on top of codeigniter edit database stuff web app. right not password protected, since still being developed. want integrate wordpress installation client not have log cms and wordpress. where far is: i have created custom wp admin_menu (via add_menu_page ) i have cms visible/working in iframe of admin menu tab. what need allow access these cms pages if user authenticated wordpress admin. in case wondering directory structure: / (codeigniter installed on root) /blog/ (wordpress install) /blog/cms/ (cms talking codeigniter) thank in advance! update: since hasn't been answered in answers yet, need know how execute wordpress functions outside of wordpress system. you want use wordpress's current_user_can() function confirm user has @ least 1 capability associated admin user, or member of administrator role. according codex page, should work test administrator based on role, although i

proximitysensor - Android proximity sensor when uncoverd -

i work in project use proximity sensor program should mute phone when proximity sensor covered , restore normal when sensor uncovered. managed code when sensor covered don't know value far when sensor uncovered need code unmute when sensor uncovered. @override public void onsensorchanged(sensorevent event) { audio.setringermode(audiomanager.ringer_mode_silent); } public void onsensorchanged(sensorevent event) { // todo auto-generated method stub if(event.sensor.gettype()==sensor.type_proximity){ if(event.values[0]<5){ audio.setringermode(audiomanager.ringer_mode_youwant);}else{ audio.setringermode(audiomanager.ringer_mode_silent);} } }

HTML Agility Pack - using XPath to get a single node - Object Reference not set to an instance of an object -

this first attempt element value using hap. i'm getting null object error when try use innertext. the url scraping :- http://www.mypivots.com/dailynotes/symbol/659/-1/e-mini-sp500-june-2013 trying value current high day change summary table. my code @ bottom. firstly, know if going right way? if so, xpath value incorrect? the xpath value obtained using utility found called htmlagility helper. firebug version of xpath below, gives same error :- /html/body/div[3]/div/table/tbody/tr[3]/td/table/tbody/tr[5]/td[3] my code :- webclient mypivotswc = new webclient(); string nodevalue; string htmlcode = mypivotswc.downloadstring("http://www.mypivots.com/dailynotes/symbol/659/-1/e-mini-sp500-june-2013"); htmlagilitypack.htmldocument doc = new htmlagilitypack.htmldocument(); doc.loadhtml(htmlcode); htmlnode node = doc.documentnode.selectsinglenode("/html[1]/body[1]/div[3]/div[1]/table[1]/tbody[1]/tr[3]/td[1]/table[1]/tbody[1]/tr[5]/td[3]"); nodevalu

xaml - ListView alignment issue in Windows 8 -

i have strange issue, tried every trick knew centre align listview placed inside grid. no matter what, looks left aligned. width , height of listview data bound. (width can take values 350 or 700 , height can take 100 or 200 depending on size settings. if size settings compact should 350x100 , and if normal 700x200). this xaml code <grid x:name="gridpagelvportrait" grid.row="1" grid.column="0" grid.columnspan="4" background="beige" horizontalalignment="center" verticalalignment="top" margin="0,0,584.714,0" width="781"> <listview x:name="pagelvportrait" itemssource="{binding}" canreorderitems="true" allowdrop="true" horizontalalignment="center" selectionmode="single" isswipeenabled="true" isitemclickenabled="true" selectionchanged="pagelvportraitselectionchanged" itemclick="pagelvportr

lotus notes - How to keep autocomplete event active on Xpages -

i've xpages in set fields filter documents, autocomplete in 1 of these. at end, button make pdf based on query fields (onclick action), , pdf presented saved or open. ad point, autocomplete doesn't work anymore, need reload xpage make autocomplete active again, loose other field values set in previous search. is possible keep autocomplete alive? my guess serve pdf directly page , no in separate window. make xpage stall , wait timeout of kind. i on pdf generation button add on js timeout. xsp.allowsubmit() that works in cases have encountered.

matlab - Image formats in a directory -

i have piece of code imgpath = 'f:\sift\images\'; dcell = dir([imgpath '*.jpg']); here open directory , list of images of type jpg in dcell want not jpg other image formats png or tiff,etc considered...please help! thank you assuming folder, f:\sift\images\ contains requisite image files, use: imgpath = 'f:\sift\images\'; %specifies directory path string. dcell = dir(imgpath); %gets entries in directory; similar `dir` command in windows or `ls` command in linux. %by default, first 2 output entries of `dir` `.` , `..` refer current , parent directories respectively. dcell = dcell(3:end); %eliminates default dir entries `.` , `..` truncating first 2 array elements. now results can accessed as: dcell(1) %entry corresponding first file. dcell(2) %entry corresponding second file. and on. each output entry of dcell struct following fields: name date bytes isdir datenum to individual field, use: dcell.name and on

java - import a web project using ant build file -

i have web project trortoisesvn . when import project workspace using ant build.xml become simple java project. not recognize web-inf , web root folder. how import project workspace ? you can make empty project want, , copy file project created. , enter "f5" see or not success!

c# - Service Layer between BLL und Presentation Layer -

i have question service layer in asp.net mvc application. in service layer, there dto's , di business , data access layer. in service layer map dtos domain model. means, define dto classes in service layer , map ef entities , send business layer. correct? i don't understand how call methods business layer in mvc application. think in business layer have define createuser() method or else. of processes takes place in business layer. service layer have createuser() method, call presentation layer? i think, don't understand how service layer implemented, think it's implement it, because facade bll , dal presentation layer. thanks dominik

I'm having paypal pains, any experts in the house? -

i've been searching high , low decent (up-to-date) paypal class use simple checkout requirements, in absence of such class i've tried roll own: $paypal = array( 'cmd'=>'_cart', 'business'=>'kung@foo.com', 'no_shipping'=> 1, 'return'=>'http://www.foo.com', 'cancel_return'=>'http://www.foo.com', 'currency_code'=> 'gbp', 'charset'=>'utf-8' ); $i=0; $cart = array(); foreach ((array)$_session['place_ad']['cart'] $value) { $i++; $cart = array("item_name_$i" => $value['title'], "amount_$i" => $value['price']); $paypal = array_merge($paypal, $cart); } header('location: https://www.paypal.com/cgi-bin/webscr?'.http_build_query($paypal)); as far can see, passed paypal correctly, paypal spits out i'm taking gibberish

c# - Logging serial port data which is used by another process -

i have third party tool, allows connect device via serial port. connect device, tool sends signal via serial port. need know signal sent via serial port. need data implementing other logic. please suggest me. one solution setup virtual serial ports using http://com0com.sourceforge.net/ real serial port com1 do com1 <--> app <--> virtualcom1 <-- virtual connection -> virtualcom2 <---- third party tool your app passes data between virtual com , com1 , can intercept data like

vb.net - Get file version -

i can file version of exe(its own version) in vb6 using app.major , app.minor , app.revision etc. how can same in vb.net. tried using following 3 methods. text1.text = my.application.info.version.major & "." & my.application.info.version.minor & "." & my.application.info.version.build & "." & my.application.info.version.revision text2.text = me.gettype.assembly.getname.version.tostring() text3.text = my.application.info.version.tostring() in 3 cases returning assembly version (i checked in bin folder exe created in xp machine.in windows 8 didnt see option assembly version when see file properties) by default both assembly , file versions same.but when changed manually in project properties->applicationassembly information->file version came know code returning assembly version. how can file version? assembly , file vesrion? so in .net programs, there 2 versions, not 1 (of i'm aware). assembly versi

c# - Receive response as XML -

when user clicks button, need run database query receive database response xml. newbie, , unable find tutorials. might because have no clue how search it. can point me tutorial describes how ? i think need @ 'for xml' keyword(s) there couple of ways shape data msdn link below start msdn xml

asp.net mvc 3 - How to Get background image from db -

i trying set div's background image db. for using $("#" + kcode).css("background-image", "url('/hierarchy/getfile/11012')" ); and server code follow [httpget] public filestreamresult getfile(string id) { stream strm = new memorystream(); //my db code filestreamresult fsr = new filestreamresult(strm,"image"); return fsr; } but not getting it. instead getting error in firebug { "networkerror: 404 not found - //localhost:7474/hierarchy/getfile/11012"} other post method on same location working fine. am doing wrong? thanks in advance. vidhin

php - CodeIgniter variables in constructor -

looked topics around, didn't see case. so, have controller filled methods, , construcor loads models commonly use in specific controller. works fine. needed set array in constructor like $data["content"]["something"] = "bla bla"; thats all. pass $data["content"] view loader, , i'm expecting have access $something , no. takes undefined variable, why? when put in specific method works fine, when in constructor says undefined. ideas? thank you! :) you cannot access constructor variables in view. need pass controller's method , pass view. example, in constructor : $data["content"]["something"] = "bla bla"; in controller's method : $data['something'] = $this->$data["content"]["something"]; now can pass $data view , access echo $something ;

objective c - How can I get CCMenuItemSprite selector to call other layer void? -

the below code works great when i'm calling void in same .m file want selector go 2nd layer in scene 'moveupselected' void (which contains actions sprites movement). how can this? hudlayer.m button code in layer communicate other layer self.dpad = [ccsprite spritewithfile:@"dpad.png"]; ccsprite *dpadselectedsprite = [ccsprite spritewithtexture:[dpad texture]]; dpadselectedsprite.color = ccgray; //float dpadheight = flaresprite.texture.contentsize.height; ccmenuitemsprite *dpadbuttons = [ccmenuitemsprite itemwithnormalsprite:dpad selectedsprite:dpadselectedsprite target:level1 selector:@selector(moveupselected)]; dpadbuttons.position = cgpointmake(size.width / 2, 150); [menu addchild:dpadbuttons]; level1.m void in 2nd layer waiting called 1st layer button - (void)moveupselected { int yposition = self.player.position.y; yposition += [self.player texture].contentsize.height/2; cgsize size = [[ccdirector shareddirec

javascript - PHP/jQuery to submit/save input with all special characters value -

example.. html : <input type="hidden" value=""> php : <input type="hidden" value="<?php echo $value;?>"> jquery : $("input:hidden").val(text); if text (js variable) free text, html special characters allowed (like single quote / double quote) , save input:hidden (so submit php) what correctly way ? may use echo htmlentities($value); ... in php or replace quotes in jquery .val(text.replace(/'/g,"’")) or ? ps : please think when set value input save value jquery too. converting htmlentities should work fine. you can use strip_tags if want remove html tags : note: not stop xss attacks

iphone - Disable/enable scrolling in UIPageViewController -

i got viewcontroller inherits uipageviewcontroller ( @interface pagescrollviewcontroller : uipageviewcontroller ) i'm wondering how can enable , disable scrolling uipageviewcontroller ? when using uiscrollview setscrollenabled:no , self.view.userinteractionenabled = no; isn't option since blocks whole uiview instead of scrolling. edit in pagescrollviewcontroller : uipageviewcontroller class: if ([[notification name] isequaltostring:@"notificationdisable"]){ nslog (@"successfully received disable notification!"); (uigesturerecognizer *recognizer in self.gesturerecognizers) { recognizer.enabled = no; } } try looping through gesturerecognizers of uipageviewcontroller , disable/enable them: for (uigesturerecognizer *recognizer in pageviewcontroller.gesturerecognizers) { recognizer.enabled = no; } note: found in this post , method work uipageviewcontrollertransitionstylepagecurl . may want try t

animation - Transforming Kinect coordinates to character model -

i have latest kinect sdk, xna 4.0, , model skeleton , i'm looking working kinect create simple games. heard various engines, such digitalrune engine provide easy way map skeleton generated kinect sensor skeleton of model. which engine best task , why? i'd prefer if list both best free engine , 1 have pay for, additional suggestion, should have them. i need this. while did manage find 5 engines might suit needs (ploobs, engine nine, digitalrune, hilva, xen, xna final engine) have no way of telling better other, there little activity in related forums , don't have time (or, more importantly, knowledge) test these engines. i think xna better, because gives more transparency when comes game programming, there no doubt used game programming , plus point have tons of tutorials. xna framework best can have e-books too.

android - How to call variable in java -

i created 2 java file, in 1 java file android list view position in integer type position variable, how call position value in java file `public void onitemclick(adapterview parent, view view, int position,long id) { intent intent = new intent(this, play.class); startactivity(intent); int pos = position;'//<------------ assigned pos position need call pos play.class file classname cn = new classname(); // creating instance of class cn.variable; if variable static can call way. classname.variable;

sql - SQLDataReader Invalid object name -

i trying authenticate user through login form reading user details database usersdb. on attempting read, error: invalid object name: usersdb i got no errors when adding new user database not know why getting error. here stack trace getting: [sqlexception (0x80131904): invalid object name 'usersdb'.] system.data.sqlclient.sqlconnection.onerror(sqlexception exception, boolean breakconnection, action`1 wrapcloseinaction) +388 system.data.sqlclient.tdsparser.throwexceptionandwarning(tdsparserstateobject stateobj, boolean callerhasconnectionlock, boolean asyncclose) +810 system.data.sqlclient.tdsparser.tryrun(runbehavior runbehavior, sqlcommand cmdhandler, sqldatareader datastream, bulkcopysimpleresultset bulkcopyhandler, tdsparserstateobject stateobj, boolean& dataready) +4403 system.data.sqlclient.sqldatareader.tryconsumemetadata() +82 system.data.sqlclient.sqldatareader.get_metadata() +135 system.data.sqlclient.sqlcommand.finishexecutereader(sqldatareader ds, runbehav

android - In-app billing testing using different google account -

to test in app billing, said need factory reset , specify test account when device boots up. i have configured 2 google accounts , can somehow test account active transactions , revert original when done in-app billing testing ? i not able understand need factory reset test in-app billing when can set multiple google accounts. after looking around factory reset way change device account. there issue problem on android market in-app billing i'm guessing cant use personal account because same developer console account (which google doesn't allow). however, if using personal account on device change developer console account . this means test personal account avoiding factory resets.

jms - Is it possible in Camel to set different request timeout for each message send to ActiveMQ? -

i have request/reply activemq processing camel route time needed process message different depending on message. possible set requesttimeout inside of camel exchange instead of in route definition? this not possible. what use-case using different timeouts? adding such functionality camel-jms.

android - how to get google project id and pushwoosh app id? -

i trying push notification phongap. i followed following tutorial http://www.pushwoosh.com/programming-push-notification/android-gcm-push-notifications-guide/ but there need have google project id , pushwoosh app id . process these ids..??? any appreciated! this guide shows can find google project id: http://www.pushwoosh.com/programming-push-notification/enabling-gcm-services-for-google-api/ pushwoosh app id application code (xxxxx-xxxxx) can find on application page in pushwoosh control panel.

android - Stop an app by calling the lifecycle callbacks -

how can stop whole app in simple terms? (all activities, services, threads, etc. everything) life-cycle callbacks (especially onstop() , ondestroy() ) should called. google suggests following possible solution: kill process: wouldn't call lifecycle callbacks and finish(); 1 activity: but possible access method outside like: //getting activityies, how? //for each gotten activity acitvityname.finish(); or via or via getparent().finish(); ? this did not me: best way quit android app? fd use broadcast receiver call activities , call finish locally in them, invoking current lifecycle callbacks. broadcastreceiver , paused activity http://developer.android.com/reference/android/content/broadcastreceiver.html

eclipse - Java EE doesnt update the changes I make -

it's simple setting cannot find since yesterday eclipse doesn't propagate updates code of servlet. only source code doesn't updated jsp pages still updated. someone has idea problem can be. -i've created new glassfish server -and i've been trying random things debug , updating glassfish core

geometry - center of mass 3d matlab -

i have sparse 3d volume (cube), @ each x,y location want create sphere radius r, center located @ x,y,z. each sphere want compute center of mass. my questions: the points within each sphere not evenly distributed, center of mass not centroid, how compute center of mass ? found many different ways... i need compute @ each size(x)*size(y) times, can quite large, can create 3d sphere this: w = ceil(r)*2+1; [x,y,z] = meshgrid(1:w,1:w,1:w); xc = floor(w./2)+1; yc = floor(w./2)+1; zc = floor(w./2)+1; mask = (x-xc).^2 + (y-yc).^2 + (z-zc).^2 <= r.^2; mask = double(mask); but make me go loop each point, , time consuming. matlabit take @ update step of k-means clustering , find center of mass sphere. to find points should included in sphere calculate , threshold euclidean distance between centroid of sphere , each point. if distance less sphere's radius include it. do in 3 deep nested loop on set of x,y,z sphere centroids, , you're done.

javascript - Need to parse complex Json -

i have , json data getting server,struggling parse json in javascript not straight forward json. here sample [ { "target":"collectd.matrix.oracle.avg_resp_time", "datapoints":[ [8.0, 1365158480], [null, 1365158490], [null, 1365158500], [null, 1365158510], [null, 1365158520], [null, 1365158530], [8.0, 1365158540], [null, 1365158550], [null, 1365158560], [null, 1365158570], [null, 1365158580], [null, 1365158590], [8.0, 1365158600], [null, 1365158610], [null, 1365158620], [null, 1365158630], [null, 1365158640], [null, 1365158650], [8.0, 1365158660], [null, 1365158670], [null, 1365158680], [null, 1365158690], [null, 1365158700], [null, 1365158710], [null, 1365158720], [null, 1365158730], [null, 136515

dart - How to listen to keyUp event in capture mode? -

i looking @ dart api find way listen keyup event using capture mode. new stream system there's no parameter specify capture anymore: document.body.onkeyup.listen(callback); // where's old "usecapture" parameter? to achieve same thing streams, here's example: element.keyupevent.fortarget(document.body, usecapture: true).listen((e) { // stuff. print('here go'); }); the method used above, creates stream capture mode. stream interface ( listen() method) quite generic, , can't have specific functionality looking for.

jquery - Issue with responsive height on caroufredsel image carousel -

i using caroufredsel plugin responsive images, slider getting full height of images (before resized) , leaving big gap @ bottom. the function being called within window.resize function because need check width of window. need because number of items shown has vary, , if window below width have destroy carousel , show items. here code: $(document).ready(function(){ $(window).resize(function(){ var numitems; var width = $(window).width(); if(width >=769) { numitems = 5; } else { numitems = 3; } var carousel = $("#carousel"); $("#carousel").caroufredsel({ responsive : true, scroll : 1, items : { visible : numitems, width : 200 }, oncreate : function () { carousel.parent().add(carousel).css('height', carousel.children().first().height() + 'px'); } }); if (width <=480){ $("#carousel").trigger("destroy"); } }).resize();//trigger resi

php - TCP_NODELAY with persistent socket? -

it seems can either persistent socket connection pfsockopen(), or normal socket connection socket_connect() using socket_set_option() set tcp_nodelay. there no way persistent socket connection tcp_nodelay. is there way persistent socket connection tcp_nodelay in php?

Invoking out of browser app from in-browser app in silverlight -

we need have functionality of users running excel reports silverlight application. application show data server , upon clicking button users should see excel report data in client machines. can't make original application out of browser looking options. i thinking of creating out of browser application can invoke excel in client machine. our original application have download , install out of browser application user permissions. need pass data excel report in-browser application oob applications. is possible? if is, there available how this? the thing comes mind popup browser window in-browser silverlight application , offer excel file download client. default dialog offers open option , solve problem. that's how solved excel report download ssrs in silverlight application.

iphone - Autoresize not working in xib -

Image
i made simple design in .xib , deployment target app ios 5 view doesn't resizes, when run app in simulator or device. here snapshot of .xib file.. when try run app in simulator, runs in simulator of 4", not resizes, when run app in simulator of 3.5". autoresize subview property checked. here snapshot of simulaotrs , first screenshot 3.5" , second 4".. thanks in advance. if want autoresize , autoorder icons referencing upper view, try play either layout tab or create each layout own .xib ;)

java - Caching with Google App Engine -

when using app engine datastore storing entities, applied technique caching. i mean, without caching do, this: datastoreservice _ds = datastoreservicefactory.getdatastoreservice(); public void put(string key, string value){ try { entity e = new entity(createkey(key)); e.setproperty("key", key); e.setproperty("value", value); _ds.put(e); } catch (exception e) { // handle exception } } so caching kicks in? how caching play during methods. update: simply put question when caching. basic implementation not caching @ all, plain put , datastore. should caching implemented on lowest level api in code or in high level api, in case, lowest level api have this, put , datastore. there 2 kinds of caching think in app engine: memcache ds entities , edge caching static assets. video google covers both nicely specific code examples: google i/o 2012 - optimizing google app engine app for edge caching

java - Where is Performance Tuner in Glassfish 4? (optimizing for Raspberry PI) -

i can`t find performance tuner in glassfish 4. can find it? want optimize performance of glassfish 4 raspberry pi. the performance tuner included in oracle version of glassfish (not in community edition).

HTML5 Drag and Drop - prevent drop for one item -

i looking @ html5 demo of bin 'eats' in list . want modify 'eat' of items , others rejected. the code here: http://html5demos.com/drag this code works in ie requirement. tips appreciated. being impatient found way this.. <ul> <li><a draggable="true" id="one" href="#">one</a></li> <li><a draggable="true" href="#" id="three">two</a></li> <a draggable="true" href="#" id="trick">trick</a> <li><a draggable="true" href="#" id="four">four</a></li> <a draggable="true" href="#" id="five">five</a> </ul> the solution realise add tag within list. had style tag same list item. if person tries drag trick item doesn't disappear list , bin doesn't provide text response.

c++ - template operator -> -

is there way conviniently call template operator-> ? cool have such possibility in classes variant for example: (thats example) struct base_t { template<class t> t* operator->() { return reinterpret_cast<t*>(this); } }; int main(int argc, char* argv[]) { base_t x; x.operator-><std::pair<int,int>>()->first; //works, inconvenient x<std::pair<int,int>>->first; // not work x-><std::pair<int,int>>first; //does not work return 0; } i need proofs =) no, it's not real, how it's not real too struct base_t { template<class t> t operator () () { return t(); } }; int main() { base_t x; x.operator ()<int>(); // works x.()<int>(); // not works } expression x->m interpreted (x.operator->())->m class object x of type t if t::operator->() exists , if operator selected best match function overload resolution mechani

codeigniter - overwrrite code igniter Common.php -

there method in code igniter under system/core/common.php called load_class (). i overwrite method. overwrite code igniter class create file such my_common.php in case common.php collection of methods , there no classes encapsulates them. so how do this? there's no officially supported way built in extending mechanisms. consider other way achieve goal. however functions inside common.php wrapped inside if checking if function exists or not can following: create my_common.php put somewhere in project (maybe application/core/ mirror other similar extends) open index.php file in root of project insert include apppath.'core/my_common.php'; before closing require_once basepath.'core/codeigniter.php'; line now if have have load_class function in my_common.php shadow original version.

php - json_encode with a different result after array_filter -

i want json_encode return this [{key: "value"},{key:"value"},...] instead this: {"1": {key: "value"}, "2": {key: "value"}, ...} the result fine until did array_filter ... strange... function somefunction($id, $ignore = array()) { $ignorefunc = function($obj) use ($ignore) { return !in_array($obj['key'], $ignore); }; global $db; $q = "some query"; $rows = $db->givemesomerows(); $result = array(); if ($rows) { // mapping i've done $result = array_map(array('someclass', 'somemappingfunction'), $rows); if (is_array($ignore) && count($ignore) > 0) { /////// problem after line //////// $result = array_filter($result, $ignorefunc); } } return $result; } so again, if comment out array_filter want json_encode on whatever somefunction returns, if not json-object.