Posts

Showing posts from September, 2011

c# - Grab user input from dynamic text box -

i have 2 buttons . 1 button creates textbox , submits information. i'm having trouble retrieving users texts once textbox has been created. here code: private void createtextbox(int j) //creates fields / cells { textbox t = new textbox(); t.id = "textbox" + j; //t.text = "textbox" + j; lsttextbox.add(t); var c = new tablecell(); c.controls.add(t); r.cells.add(c); table1.rows.add(r); session["test"] = lsttextbox; } protected void button2_click(object sender, eventargs e) { string[] holder = new string[4]; (int = 0; < holder.length; i++) { holder[i] = ""; } list<textbox> lsttextbox = (session["test"] list<textbox>); if (lsttextbox.count < counter) { int = lsttextbox.count; (int j = 0; j < i;

Setting Application-level font size in PowerPoint -

in excel can like: activeworkbook.styles("normal").font.name = "calibri" this replicates action of navigating home ribbon , choosing particular font used, avoid having programmatically assign different fonts in dozens of places. is there equivalent in powerpoint? activepresentation.styles returns error. i use object browser , search style (hoping find obvious/intuitive) there dozens of results, none of them particularly promising. hoping else has run in before. with trial , error, seems trick: with activepresentation .slidemaster.theme.themefontscheme.minorfont.item(1).name = "calibri" end there .majorfont looks .minorfont need.

pug - Jade-Handlebars package preventing Meteor server from starting -

i attempting use jade-handlebars ( https://github.com/simondegraeve/meteor-jade-handlebars ) package atmosphere. installed using meteorite. problem when attempt run meteor server following error message/output on startup: initializing mongo database... may take moment. no dependency info in bundle. filesystem monitoring disabled. => errors prevented startup: exception while bundling application: referenceerror: require not defined @ /home/ewillis1/collaboratum/packages/jade-handlebars/package.js:5:21 the specific line referencing in package.js var fs = require('fs'); any or direction appreciated if can me package working meteor 0.6.4! https://stackoverflow.com/a/17007054/1408362 i found partial answer own question. seeing jade-handlebars package last updated 7 months ago(at time), using basic "require()" method in package.js file, when newer versions of meteor(0.6.4 @ time) want use npm.require() see

ruby on rails - Trying to check a String number against Range -

i have situation data number, , saved string. have range want check string against. item in range integer. how can this? below code scope writing: if value == "above" scope.where(["level > ?", level_range.last]) elsif value == "below" scope.where(["level < ?", level_range.first]) elsif value == "at" scope.where(:level => level_range) else scope end you level numbers stored strings. first of all, that's kinda dumb; if can, fix schema store numeric. if can't change schema, , db ansi compliant, can use cast() on stored value perform integer comparisons range parameters. if value == "above" scope.where(["cast(level integer) > ?", level_range.last]) elsif value == "below" scope.where(["cast(level integer) < ?", level_range.first]) elsif value == "at" scope.where(["cast(level integer) between ? , ?", level_ran

sql server - use sql stored procedure to insert data which is returned from a query stored in a table -

sql server 2005 have stored procedure used insert data table. of data need come results of executing query stored in separate table. the main problem keep hitting not being able execute returned query. have tried creating several functions on past couple of days based on other posts have read, keep hitting sql errors exec, execute, sp_executesql, etc. i going paste several scripts can use replicate environment. hoping can please provide actual code sample execute returned query use within stored proc insert function. thank you!!! create table [dbo].[client]( [cli_id] [int] identity(1,1) not null, [cli_first_name] [varchar](100) null, constraint [pk__client__07f6335a] primary key clustered ( [cli_id] asc )with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on, fillfactor = 90) on [primary] ) on [primary] go set ansi_padding off go insert client (cli_first_name, cli_last_name) value

undefined reference to gnuradio in C++ using Android NDK -

i trying access gnuradio functions in android, bandpass filter function. without calling functions, ndk-build compiles code. when call complex_band_pass(...) function, gives me error of undefined reference to: error ndk-build: error: undefined reference 'gr_firdes::complex_band_pass(double, double, double, double, double, gr_firdes::win_type, double)' collect2: ld returned 1 exit status in android.mk file particular file: include $(clear_vars) local_module := rxfilter local_src_files := src/rx_filter.cpp local_c_includes += /usr/local/include/gnuradio \ /usr/local/include \ ${android_ndk_root}/sources/cxx-stl/stlport/stlport local_cflags := -dandroid -duse_liblog local_shared_libraries += rtlsdr local_static_libraries := /usr/local/lib/libgnuradio #doesn't seem local_ldlibs += -llog include $(build_shared_library) in rx_filter.cpp file: #include <jni.h> #include <cmath> #include <math.h> #include

r - Makefile gives strange error while compiling markdown file into .docx file -

i having problems makefile creating docx file rmd using r. here make file, patially works fine, except last part: all: ibn_paper.pdf; cabg_n_cor_draft.docx ibn_paper.md: rscript -e "library(knitr); knit('ibn_paper.rmd')" ibn_paper.pdf: ibn_paper.md pandoc -h format.sty -v fontsize=12pt --bibliography ibn_refs.bib ibn_paper.md -o ibn_paper.pdf cabg_n_cor_draft.docx: ibn_paper.md pandoc -s -s -v fontsize=12pt --bibliography ibn_refs.bib ibn_paper.md -o cabg_n_cor_draft.docx clean: @-rm -r *.md and code works , creates @ end error: make: cabg_n_cor_draft.docx: no such file or directory make: *** [all] error 1 exited status 2. how can solve problem? many beforehand. try remove semicolon in first line. wanted let all depend on 2 files. semicolon separates recipe list of prerequisites. @ makefile rule syntax

java - Using a Local Temp Table and such using SimpleJdbcTemplate (or Spring) -

first off, admittedly, no dba...so sql-fu weak. i working on project had pretty hefty report did 10 inner joins. when ran against prod data (sql server 2005) using sql studio management client, query wasn't barn-burner, returned in under 20sec. however, when ran through spring, 31min. so, got our dba ninja on it, , pointed out query plan different because jdbc method use prepared statement, passing in variables parameters, whereas in client hard-coded. so, re-worked query. the resulting query sets declare variables top, uses create local temp table, uses local temp table part of ultimate report query. said should able send part of same query string (compound query????). looks (obfuscated protect innocent): declare @startdate datetime declare @enddate datetime set @startdate = dateadd (dd, 0, datediff (dd, 0, '2013-03-01 00:00:00.000')) set @enddate = dateadd (dd, 1, datediff (dd, 0, '2013-08-08 00:00:00.000')) create table #latest_blah_action (

html - Divs don't merge -

Image
i have layout: i trying make div slideshow, above red thing, above section of header. i tried z-index , , lot of other ways, cannot layout work. this code:` <div id="box"> <div class="clear"></div> <div id="slideshow"> <ul> <li> <img src="imagens/1.png" alt="curso 1" class="banner" /> </li> <li> <img src="imagens/2.png" alt="curso 2" class="banner" /> </li> <li> <img src="imagens/3.png" alt="curso 3" class="banner" /> </li> <li> <img src="imagens/4.png" alt="curso 4" class="banner" /> </li> </ul> </div> <div class="

javascript - Remove comma at the begining at the of new results output -

i use script copy values span class values in form. when copy more 1 script adds comma @ beginning of returned results. not sure problem is. <script> var results = []; $('input[name="clickme"]').change(function () { var id = $(this).attr('class'); $('table#' + id).toggleclass('selected'); var proc_code = $('table#' + id + ' .proc_code').text(); var medicare = $('table#' + id + ' .medicare').text(); var status = $('table#' + id + ' .status').text(); var ata_id = $('table#' + id + ' .ata_id').text(); var sys_app = $('table#' + id + ' .sys_app').text(); var submitter = $('table#' + id + ' .submitter').text(); var email = $('table#' + id + ' .email').text(); var add_cpt = $('table#' + id + ' .add_cpt').text(); var change = $('table#' + id + ' .change'

For loop problems in R -

i have 365x1 vector called dv (day value). applying function generate hourly values, hv. codes follows: sigma<-0.246*dv stime<-function(x,y,z){(exp(-(x-12)^2/(2*y^2))+cos(pi*(x-12)/(z-1)))/(2*y*sqrt(2*pi))} t<-1:24 hv<-null (i in seq(along=t)){hv<-c(hv,mapply(stime,t[i],sigma,dv))} i want first 24 values using t[1],t[2],...t[24] z=dv[1] , next 24 values use z=dv[2] etc. code have first 365 values dv[1],dv[2]...dv[365] take t[1] next 365 values take t[2] ...i not sure if explain clearly. appreciate help. r vectorised exp , cos , sqrt , arithmetic operators need loop along dv values. here example using function sapply , , first 3 t values brevity... dv <- 1:5 sapply( dv , function(i) stime( x = t[1:3] , y = 0.246*i , z = ) ) [,1] [,2] [,3] [,4] [,5] [1,] nan -0.4054291 -6.621773e-16 0.1013573 -1.146727e-01 [2,] nan 0.4054291 -2.702861e-01 -0.1013573 7.689812e-16 [3,] nan -0.4054291 1.489523e-16 -0.

html - Keep images with size set to percentage on the same scale with window resize -

Image
i building web app. size of images set using percentages. have 3 images overlapping image used toolbar. when have images display browser on full screen, fine. however, when have them displayed screen smaller, ratio of image size screen seems change. can change this? full size: smaller size version: notice difference in size of icons. my code: <div id="bottombar" data-position="fixed"> <img id="ico" class="foodico" src="images/icons/food1.png" width="3%"> <img id="ico" class="shopico" src="images/icons/shop1.png" width="3%"> <img id="ico" class="activityico" src="images/icons/activity1.png" width="3%"> <img id="bbackground" src="images/icons/navbarbackground.png" width="100%" height="7.8%"

linux - Syntax error: end of file unexpected (expecting "then") -

i making code minecraft server plugin updater new shell scripter don't know alot... when run code error: #!/bin/sh export path=$path:. #options plugindownloadlink=http://api.bukget.org/3/plugins/bukkit/$pluginname/latest/download # plugin folder if [ -f $pwd\plugins ]; plug=$pwd\plugins else plug=$pwd\plug-ins fi cd $plug if [ ! -f .\update ]; mkdir update echo making directory "update".. fi # plugins found in $( ls ); pluginname=$i done cd .\update wget $plugindownloadlink # no plugins found if [ ! -f $plug ]; echo echo echo no plugin found. echo echo echo echo plugins can downloaded here: echo http://dev.bukkit.org/bukkit-plugins fi # stop sleep 3s exit i error: syntax error: end of file unexpected (expecting "then") so put "then" in place wanted me , ran again: gave me error now: syntax error: end of file unexpected i wrote on windows 7 notepad++ how can fix this? i

ajax - Retrieve data from crossdomain api with authentication -

i wanted know, how proper way data javascript cross domain api have authentication? far, know jsonp not option because browser prompt user perfom manual authentication. try angular , i'm pretty new it. it's sure @ point mix many concepts, i'm tired , confused trying achieve without proper knowledge. main hihglight basic concepts on matters. cors can used modern alternative jsonp pattern, though may not solve issue browser prompting user. you may need clarify browser prompt can use jsonp without browser prompts. time have known browser prompt when making http:// jsonp call https:// page. security feature of browsers , can solved serving jsonp endpoint on https.

Two way databinding with Linq to SQL in a WPF textbox or other control -

i'm trying create 2 way databind using wpf textbox control results of linq query. wrote application test this, although last row table shows on initial load, once add new row new value isn't updated in textbox. code: xaml-code: <window x:class="wpfapplication2test6.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <grid> <textbox x:name="tbtest" borderbrush="#ffcb5d5d" width="50" height="25" text="{binding source=valuep, path=processid, mode=twoway, updatesourcetrigger=propertychanged}"> </textbox> </grid> </window> c# codebehind: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; usi

javascript - Can not fetch json content from remote web address -

Image
i trying fetch data http://status.mojang.com/check not getting data back. getting data in response tab (google chrome) i running on webserver test , tried local. this code: $.getjson("//status.mojang.com/check?jsoncallback=?", function(result) { console.log(result); }); any appreciated according jquery page ( http://api.jquery.com/jquery.getjson/ ), this shorthand ajax function, equivalent to: $.ajax({ datatype: "json", url: url, data: data, success: success }); as accessing external url, you'll need send request jsonp call in order around access-control-allow-origin headers. means datatype needs "jsonp"

python positive and negative number list possiblities -

i'm trying make function in python takes list of integers input , returns greater list containing positive , negative possibilities of numbers. pretend '+' positive number , '-' negative number the output should match with: foo([-4]) >>> [ [4], [-4] ] foo([+, +]) >>> [ [+,+], [+,-], [-,+], [-,-] ] foo([-, +]) >>> [ [+,+], [+,-], [-,+], [-,-] ] foo([-1, 3]) >>> [ [1,3], [1,-3], [-1,3], [-1,-3] ] foo( [+,-,+] ) >>> [ [-,-,-],[+,-,-],[-,+,-],[-,-,+],[+,+,-],[+,-,+],[-,+,+],[+,+,+] ] for numbers, can use itertools.product create combos, after generating list both positive , negative numbers: from itertools import product def foo(nums): return list(product(*((x, -x) x in nums))) demo: >>> foo([-4]) [(4,), (-4,)] >>> foo([-1, 3]) [(1, 3), (1, -3), (-1, 3), (-1, -3)] >>> foo([1, 3]) [(1, 3), (1, -3), (-1, 3), (-1, -3)] >>> foo([1, -3, 4]) [(1, 3, 4), (1,

stub - iOS OCMock call back method with parameter -

i want use ocmock such whenever somemethod called argument, calls callbackmethod: argument "dict", nsdictionary . found andcall:onobject: doesn't seem let pass argument. there way desired behavior? you can use anddo: , execute whatever want in given block. id yourmock;//... nsdictionary *dictionary;//... id anobject;//... [[[yourmock stub] anddo:^(nsinvocation *invocation) { [anobject callbackmethod:dictionary]; }] somemethod];

icalendar - Android: Not All Instances of Recurring Event Saved -

i working on creating custom calendar application , have been struggling saving recurring event. if example set event occur daily 100 days seeing 38 instances saved instances database. not sure why happening. here code adds/updates event public event addupdatecalendarevent(context ctx, event event) throws interruptedexception { contentresolver contentresolver = ctx.getcontentresolver(); contentvalues calevent = new contentvalues(); calevent.put(events.calendar_id, event.getcalendarid()); calevent.put(events.title, event.geteventname()); calevent.put(events.dtstart, event.getdatefrom().gettimeinmillis()); calevent.put(events.event_timezone,event.getdatefrom().gettimezone().getid()); if(event.isallday()) { calevent.put(events.all_day, 1); } if(null != event.getrrule()) { string rrule = recurrenceruleconverter.tostring(event.getrrule()); log.d("rrule: ", rrule); calevent.put(events.rrule, rrule);

unable to control android emulator from novnc client in browser (chrome) -

i have startup android emulator built-in qemu vnc server using following command on osx lion: $emulator -avd avd_name -qemu -vnc :1 after want able control emulator through chrome browser find novnc ( https://github.com/kanaka/novnc ) $openssl req -new -x509 -days 365 -nodes -out self.pem -keyout self.pem $./utils/launch.sh –vnc localhost:5901 the result can see screen of android emulator cannot control emulator web browser (i use chrome) , problem?

android - difficulties facing with multiple selection in listview -

i have listview has multiple selections. in each item, there textview saying "more". on clicking on textview, shows details of product on next page. i have done in listview's onitemclicklistener pr_id = tx.gettext().tostring(); tx text view in list having product id , pr_id product id sending next page through intent.` more.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { // todo auto-generated method stub intent i1 = new intent(product_list.this, product_view.class); i1.putextra("productid", pr_id); log.i("pid", pr_id); startactivity(i1); } });` everything works fine, problem since have multiselection , user has selected 3 items listview in order of 1st, 2nd , 3rd, when click on 1st item's "more&quo

node.js - Scrape a webpage and navigate by clicking buttons -

i want perform following actions @ server side: 1) scrape webpage 2) simulate click on page , navigate new page. 3) scrape new page 4) simulate button clicks on new page 5) sending data client via json or i thinking of using node.js. but confused module should use a) zombie b) node.io c) phantomjs d) jsdom e) else i have installed node,io not able run via command prompt. ps: working in windows 2008 server zombie.js , node.io run on jsdom, hence options either going jsdom (or equivalent wrapper), headless browser (phantomjs, slimerjs) or cheerio. jsdom slow because has recreate dom , cssom in node.js. phantomjs/slimerjs proper headless browsers, performances ok , reliable. cheerio lightweight alternative jsdom. doesn't recreate entire page in node.js (it downloads , parses dom - no javascript executed). therefore can't click on buttons/links, it's fast scrape webpages. given requirements, i'd go headless browser. in particular,

php - mysqli_num_rows() -

this question has answer here: reference - error mean in php? 29 answers a part of php code doesn't work... when write code : public $postcount = 10; public function updates($user_ids, $lastid) { if ($lastid == 0) { $loadmore = ''; } else { $loadmore = " , m.msg_id<$lastid "; } $db_conx = mysqli_connect("localhost", "root", "", "yusers"); $sql = "select m.msg_id, m.uid_fk, m.message, m.created, u.fname, u.lname, m.uploads, m.profile_uid messages m, users u m.uid_fk=u.uid , m.uid_fk in ($user_ids) $loadmore union select m.msg_id, m.uid_fk, m.message, m.created, u.fname, u.lname, m.uploads, m.profile_uid messages m, users u m.uid_fk=u.uid , m.profile_uid in ($user_ids) $loadmore order msg_id desc limit 10" . $this->postcount; $query = mysqli

c - How to use thread pool and message queues in Multithreaded Matrix Multiplication? -

i'm trying learn multithreading doing multithreaded matrix multiplication program.i'm computing 1 row @ time. facing problem when using fewer threads rows. read lot of similar posts not understand how can reuse them. there 2 possible methods. using thread pool , making task queue- did not understand after completion of task , how next task assigned particular thread among pool of threads message queues. how use mutex lock on shared variable sum? please suggest me possible changes should add in following program. #include <pthread.h> #include <stdio.h> #include <stdlib.h> #define m 6 #define k 7 #define n 8 #define num_threads 4 int a[m][k] = { { 1, 4, 8, 4, 5, 6, 2 }, { 7, 3, 2, 4, 1, 4, 5 }, { 2, 3, 9, 4, 7, 1, 5 }, { 4, 3, 9, 4, 7, 2, 5 }, { 1, 3, 9, 9, 7, 1, 3 }, { 2, 4, 9, 3, 7, 1, 5 } }; int b[k][n] = { { 8, 3, 8, 4, 5, 6, 2, 3 }, { 1, 3, 2, 2, 3, 4, 8, 1 }, { 8, 3, 9, 1, 7, 1, 5, 2 }, { 1, 3, 9, 2, 7, 2, 5, 2 },

asp.net mvc - I want to copy the value of List<CustomType> and paste them in my console apps in C# -

i working in c# code asp.net mvc app. coding in project , when test call models data in console app. now have reference of models in console app. can copy value stacktrack ,watch & immediate windows (any of all) what want want test through console app. have add reference. thing if can copy value @ debug time in mvc app , paste them in console. awesome. do have idea how in c# using express visual web developer. i have asp.net mvc app. want copy value of list , paste them in console app. feel can debug better. for doing have add model dll in console app. can gave me code can paste in console app. when debug mvc app way can copy text or list of customobject. i want paste these field testing in console app. know how can solve this. it seems want have... a running webapp a running console application start , can use fetch objects web application print them in console application debugging this wrong. this, necessary include complicated stuff serialize st

javascript - Fill inputs by clicking on div - jQuery -

i wanna fill form automatically clicking on div has contents required form. my div - <div class="ab"> <ul> <li>sahar raj</li> <li>address.</li> <li>city</li> <li>state</li> <li>pin</li> <li>9876543210</li> </ul> </div> form - <input class="required" type="text" name="name" /> <textarea name="address" class="required"></textarea> <input class="required" type="text" name="city" /> <select name="state"> <option value="0">state1</option> <option value="1">state2</option> </select> <input class="required" type="text" name="pin" /> <input class="required" type="text" name="phone"

android - How can I adjust width of webview? -

my code affective when user accessing pages clicking link. when user press back button content won't fit :( this current code pressing back button if(keycode == keyevent.keycode_back){ webview mywebview = (webview)findviewbyid(r.id.webview1); mywebview.getsettings().setsupportzoom(true); mywebview.getsettings().setloadwithoverviewmode(true); mywebview.getsettings().setusewideviewport(true); mywebview.goback(); } how can solve? if website text being wrapped, use: webview.getsettings().setlayoutalgorithm(layoutalgorithm.normal) or webview.getsettings().setlayoutalgorithm(layoutalgorithm.single_column)

I'm trying to use Java Preferences from XML WITHOUT using Windows registry, but I see a Registry-related message -

i have simplified program produces following output, in lines starting ^ generated code. note deliberately deleted prefs key in hkey_local_machine\software\javasoft. ^ preferences file found aug 09, 2013 2:45:23 pm java.util.prefs.windowspreferences <init> warning: not open/create prefs root node software\javasoft\prefs @ root 0x80000002. windows regcreatekeyex(...) returned error code 5. ^ doallunconditionally: false ^ footnotespopup: false ^ thumbnailsgenerated: true ^ thumbnailwidth: 200 ^ pathin: c:/users/das/google drive ^ pathout: c:/users/das/ottmar/site ^ pathlog: c:/users/das/ottmar/logs my question is, can bypass registry entirely? thought should able to. can post source code (180 lines) if needed. i discovered workaround (not solution) problem. stated before, had inadvertently/foolishly deleted prefs node in software\javasoft in registry, , when recreated message went away. i assume windows registry is used whether or not.

c++ - How to organize a class's member functions? -

i put 'sets' after constructors because related object setup. split gets (put gets in inquires) , sets not sure if or not. best practice organizing member functions? how that? class foo { // friends go here if has friend ...; friend ...; // first public, protected , private public: // enums enum {...} // type defines. typedef ...; ... // destructor , constructors ~foo(); foo(...); foo(...); ... // sets. void seta(...); void setb(...); void setc(...); ... // inquiries (including gets). a() const; b b() const; ... // operators. void operator()(...); ... // operations. void dosomething(); ... protected: private: }; it's hard judge, it's personal preference or company coding standard. looking @ code, few things may not agree: your declarations not ordered pubilc ,'protected` private friend declaration has same effort when declare them in pri

ajax - Is it ok for a Django mixin to inherit another mixin? -

i'm pretty sure answer question "no", since django mixins supposed inherit "object"s, can't find alternative solution problem :( to make question simple possible,,, views.py class jsonresponsemixin(object): def render_to_response(self, context): "returns json response containing 'context' payload" return self.get_json_response(self.convert_context_to_json(context)) def get_json_response(self, content, **httpresponse_kwargs): "construct `httpresponse` object." return http.httpresponse(content, content_type='application/json', **httpresponse_kwargs) def convert_context_to_json(self, context): "convert context dictionary json object" # note: *extremely* naive; in reality, you'll need # more complex handling ensure arbitrary # objects -- such django model inst

Titanium: ListView load remote images -

i've got below bit of code pull list of users facebook contacts along profile picture, images not loading each user, showing images few users. fb.requestwithgraphpath('me/friends', { fields : 'first_name,last_name,id,installed,picture.width(120).height(120),gender' }, 'get', function(e) { if (e.success) { var d = json.parse(e.result); var pdata = []; var idata = []; var row = d.data; row = row.sort(sortbyname) (var = 0; < d.data.length; i++) { var img = row[i].picture.data.url if (row[i].installed) { pdata.push({ properties : { title : row[i].first_name + " " + row[i].last_name, id : row[i].id, image : img, gender : row[i].gender, access

c++ - How to use Windows Media Player? -

i have old application written in c++ 6.0. application manages sound alarming purpose in manufacturing environment. now make modifications , use windows media player. knowledge of c++ limited. kind of lost in pointers... this managed far: used class wizard add wrapper classes wmplib.dll , included "wmp.h". in .cpp file. iwmpplayer *player = new iwmpplayer(); //player.seturl("http://streampoint.radioio.com/streams/57/45ec8c85a2a8a/listen.pls"); player->setenabled(true); player->seturl("c:\\tada.wav"); iwmpcontrols *pcontrols = new iwmpcontrols(); *pcontrols = player->getcontrols(); pcontrols->play(); any suggestions? thanks i found way. at first, wanted without having include wmp activex in view. ended adding , use classwizard create associated member variable in view. the created member variable of type cwndplayer4. here code used: m_backgroundplayer.seturl(m_url); m_backgroundplayer.getsettings().setvolume

neo4j - Can't recreate just deleted node with UniqueNodeFactory -

i created node uniquenodefactory , relationship uniquerelationshipfactory. deleted the node neoeclipse , tried recreate same node , no exception , node it's not recreated again. knows happening? public node getorcreatenodewithuniquefactory(final index<node> nodeindex, final string indexablekey,final string indexablevalue) { uniquefactory<node> factory = new uniquefactory.uniquenodefactory( global.graphdb.getgraphdbservice(), nodeindex.getname()) { @override protected void initialize(node created, map<string, object> properties) { created.setproperty(indexablekey, properties.get(indexablekey)); } }; return factory.getorcreate( indexablekey, indexablevalue ); } public relationship getorcreaterelationshiptypewithuniquefactory(index<relationship> index, string indexablekey, final string indexablevalue, final relationshiptype type, final node start, final node end) { uniquef

r - Convex hulls with ggbiplot -

Image
based on below tried script plotting pca convex hulls without success, idea how can solve it? library(ggbiplot) library(plyr) data <-read.csv("c:/users/aaa.csv") my.pca <- prcomp(data[,1:9] , scale. = true) find_hull <- function(my.pca) my.pca[chull(my.pca$x[,1], my.pca$x[,2]), ] hulls <- ddply(my.pca , "group", find_hull) ggbiplot(my.pca, obs.scale = 1, var.scale = 1,groups = data$group) + scale_color_discrete(name = '') + geom_polygon(data=hulls, alpha=.2) + theme_bw() + theme(legend.direction = 'horizontal', legend.position = 'top') thanks. the script below plot pca ellipses (slightly modified example https://github.com/vqv/ggbiplot 'opts' deprecated) library(ggbiplot) data(wine) wine.pca <- prcomp(wine, scale. = true) g <- ggbiplot(wine.pca, obs.scale = 1, var.scale = 1, groups = wine.class, ellipse = true, circle = true) g <- g + scale_color_discrete(name = '') g

java - spring mvc date format with form:input -

Image
i have hibernate entity , bean: @entity public class generalobservation { @datetimeformat(pattern = "dd/mm/yyyy") date date; @column public date getdate() { return date; } public void setdate(date date) { this.date = date; } } also have @initbinder protected void initbinder(webdatabinder binder) { simpledateformat dateformat = new simpledateformat("dd/mm/yyyy"); binder.registercustomeditor(date.class, new customdateeditor( dateformat, false)); } and form:input id = "datepicker" name="date" itemlabel="date" path="newobservation.date" when go url see: how can force have mm/dd/yyyy format? thanx you can use fmt:formatdate jstl tag: <fmt:formatdate value="${yourobject.date}" var="datestring" pattern="dd/mm/yyyy" /> <form:input

sql server - XA Datasource in Microsoft JDBC driver and jTDS JDBC Driver -

i'm little new sql server, , working in java application connecting it. found these 2 well-known jdbc drivers, microsoft 1 , jtds one. i'm trying use xa datasource. according microsoft documentation, here says have configure server, before using xa datasource. according doc, asks enable xa in server. but don't see such server-side modification required jtds. (i couldn't find doc saying so, here ) so, question how jtds manage enable xa in server, while microsoft 1 needs me enabling task? or missing here? found answer after digging in jtds driver distribution. has readme.xa file saying all. copying content below. xa support in jtds ================== version of jtds includes xadatasource class allows driver used j2ee servers support xa jdbc connections. class name net.sourceforge.jtds.jdbcx.jtdsdatasource. default driver emulate distributed transactions fooling j2ee environment believing 2 phase commit supported. emulation has serious drawback

javascript - The selection of specific fields from an array of js -

client.query("select * rooms token = ?", [data.token], function(err, results, fields) { callback(results); console.log(results); }); this query returns result array. how can necessary fields? looking @ comment, if json object -: [ { "bump":"1376149484", "user":"alex", "token":"11569", "active":0 } ] you can iterate through object -: for (var in results) { console.log('bump = ' + results[i].bump); console.log('user = ' + results[i].user); console.log('token = ' + results[i].token); console.log('active = ' + results[i].active); }

How to build a Recursive Program in VB.NET 2008 using Textboxes, Buttons, etc -

i learning vb.net 2008. have come across situation i want build recursive program factorial of number or fibonacci series 1st 50 terms, using tools windows in vb.net 2008. eg., type number in text box, click on button , output of factorial of number displayed on label. inner code should implemented in recursive way , not using simple loops only. i not finding proper way solve this. please, me out. thanks lot. you can use recursive function calls itself. private sub button1_click(sender object, e eventargs) handles button1.click label1.text = factorial(clng(textbox1.text)) end sub function factorial(byval number long) long if number <= 1 return (1) else return number * factorial(number - 1) end if end function

service - IBinder parameter to onServiceConnection() is null -

at present have server(service) client(activity) working project operated in same process. trying move server new process adding android:process=":seperateservice" in manifest. however, after successful bind service, in function public void onserviceconnected(componentname arg0, ibinder arg1) the arg1 parameter received null. appears when service made have separates processes. what missing? solved using: aidl = binder.stub.asinterface(arg1); instead of: aidl = (binder) arg1; but not sure of why not problem when both client , server in same process.

R frequency table plot y-axis logarithm scale -

is there option such log='y' when plotting frequency table. code following: df = read.table(myfile, header=f, sep=',') freq = table(df[[1]]) # make frequency table first column plot(freq, log='y') however cannot display logarithm. error message : warning messages: 1: in plot.window(...) : nonfinite axis limits [gscale(-inf,7.0814,2, .); log=1] 2: in axis(...) : "log" not graphical parameter thanks! maybe want this: plot(as.numeric(names(freq)),as.numeric(freq),log='y',xlab='',ylab='freq')

regex - Python re.search - searching from left to right -

i've got small problem. i've written module parse configuration file (wvdial's wvdial.conf) using regex. file contains strings "init1 = at" , i've used following regex: match = re.match(r'(.*)=(.*)', line) everything worked until following line: #init3 = at+cpin="0000" which got parsed like: '#init3 = at+cpin':'0000' it seems regex engine goes right left parsing string. there way reverse re.search direction? you need mark first * quantifier non-greedy appending ? : match = re.match(r'(.*?)=(.*)', line) demo: >>> line = '#init3 = at+cpin="0000"' >>> re.match(r'(.*?)=(.*)', line).group() '#init3 = at+cpin="0000"' by making quantifier non-greedy, regular expression engine match minimum satisfy pattern, rather maximum.

java - Jackson field value with no quotation marks -

is there annotation or other way tell jackson serialize string variables's value without quotation marks. serializer should serialize 1 field's value without quotation marks. i looking return of similar to: {"name": "namevalue", "click" : function (e){console.log("message");}} instead of {"name": "namevalue", "click" : "function (e){console.log("message");}"} the above how external java script library requires data, if there not way have manual alter string after object mapper has converted json. as others have pointed out, double-quotes not optional in json, mandatory. having said that, can use annotation jsonrawvalue want. public class pojo { public string name; @jsonrawvalue public string click; }

c - multiply by 0.5 rather than divide by 2 -

while reading tips in c . have seen tip here http://www.cprogramming.com/tips/tip/multiply-rather-than-divide iam not sure. told both multiply , divide slower , time consuming , requires many cycles. and have seen people use i << 2 instead of i x 4 since shifting faster. so me this.is tip using x0.5 or /2 ? or modern compilers optimize in better way? want know views of guys stackoverflow. also post links useful tips n traps in c. appreciated. it's true (if not most) processors can multiply faster performing division. but, it's myth of ++i being faster i++ in loop. yes, once was, nowadays, compilers smart enough optimize things you, should not care anymore. and bit-shifting, once faster shift << 2 multiply 4, these days over, processors can multiply in 1 clock cycle, shift operation. great example of calculation of pixel address in vga 320x240 mode. did this: address = x + (y << 8) + (y << 6) to multiply y 320. on modern

javascript - Would event.timeStamp and Date.getTime have the same reference? -

would event.timestamp , date.gettime() return same values if taken @ exact same time? for instance, use gettime() in order calculate how time passed since event occurred, or might happen 2 use different epoch / references? no, they're on same reference, utc, time zone of date internal storages. you can use date.now() .

javascript - Looping an object with an string array -

i'm rather new jquery , don't understand why loop doesn't display object properties. i grateful if me. var shop_array = ["title","price","img","text"]; var submit = $(".add").find(":submit"); submit.on("click",function(e){ var elements = $(".add").children(':input'); for(var i=0;i<elements.length;i++){ if($(elements[i]).val()!==""){ var object = '\"'+shop_array[i]+'\"'; console.log(shopcart.shop_values[object])//dosen't display shop_value; console.log(object); } } }); var shopcart= { shop_values :{ "title":"a", "price":"b", "img":"img", "text":"text" }, add: function(){ } } your problem " put around variable want use access object p

php - CakePHP display HABTM associations -

i'm new cakephp , want display list of associated tags in post's view. i have searched on web , nothing seems work. this have @ moment: // postcontroller public function view($id = null) { $this->set('tags', $this->post->tag->find('all', array('conditions' => array('posttag.post_id' => $id)))); if (!$id) { throw new notfoundexception(__('invalid post')); } $post = $this->post->findbyid($id); if (!$post) { throw new notfoundexception(__('invalid post')); } $this->set('post', $post); } // post's view.ctp echo $this->text->tolist($tags); this error i'm getting: error: sqlstate[42s22]: column not found: 1054 unknown column 'posttag.post_id' in 'where clause' this should easy stuck. thanks can help! is tag model loaded in post controller? how simply: $this->set('tags', $this->ta

javascript - AngularFire removes Firebase locations -

i'm trying create collaborative story-making app, using angular , firebase. follow link idea of i'm headed far. click on "plus" icon show textarea, , add parts there. i'm sure there many ways improve i've coded far, specific problem right relates switching between stories. i have firebase reference 2 stories, , each of stories has different parts. create way switch between stories tried following: html: <!doctype html> <html lang="en" ng-app = "storyapp"> <head> <script src="https://cdn.firebase.com/v0/firebase.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/angularfire/0.1.0/angularfire.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>