Posts

Showing posts from March, 2010

Linux: all commands return Fatal Python error: Py_Initialize: Unable to get the locale encoding -

i messing around path variables , after putting following 3 commands, every shell command execute return fatal python error: export pythonpath=$pythonpath:z3/bin export path=$path:z3/bin export pythonpath=$pythonpath:/usr/lib/python2.7 error message: fatal python error: py_initialize: unable locale encoding file "/usr/lib/python2.7/encodings/ init .py", line 123 raise codecregistryerror,\ ^ syntaxerror: invalid syntax aborted does how can fix this? running ubuntu 14.04.

html - Twitter bootstrap resize a column -

i have table class .table .table-striped .table-bordered now when try change width of second column doesnt resize. i've tried width: 50% and inline styling still no luck. override in css this: .table tr td:nth-child(2) {width:50%;} see example: http://bootply.com/60325

java - How to perform Lambda expressions and forEach on normal arrays? -

i print arraylists such as colors.foreach(color -> system.out.printf("color: %s ", color)); but somehow can't apply normal arrays ( string[] colors ). how apply expression normal arrays? basically need way perform stream operations on arrays. it's simple converting array stream: arrrays.stream(colors).foreach(color -> system.out.printf("color: %s ", color)); for more info on see java 8 stream , operation on arrays

wpf - How to set maximum length of separated word of string property C# EF -

here part of model public class sensor { public int id { get; set; } [required] [maxlength(40)] public string name { get; set; } } name text filed have maximum length of 40 symbols. , in text field possible have few words. my question is possible set maximum length of word in name property? for example have: "motion detector". , want word maximum 8 symbols. mean motion , detector need less of 8 symbols length. user can't write "motiondetector" length 12 symbols. one way can use setter in property control max length per word: set { string[] words = value.split(' ') if (words.any(x => x.length > 8)){ //error, } else { //ok, pass name = value; //only update name if length words valid } }

vba - getting null when reading cell value using excel macro -

i have sheet pivot tables used. manipulated sheet , kept 4 columns data , rest hidden. copied data sheet, sorted it. above working fine macro. once sort happens, trying read cell value check if value positive, copy 4 columns data of row row. problem have is, though there value string or double in these columns, cells(row, column).value returning empty or 0. my data copied pivot table follows: snapshotbeforesort sorted data using macro , gives me output follows: customer effort value budget value total value table snapshot now need delete rows have total value(4th column) 0.0, copy data in 4 columns row if total value > 0 or <0. to 4th column value, used following code: printing time being have check t value > or < 0. dim t double t = cells(2,4).value msgbox t the value returned 0. if tried value in first column(customer), declaring t string, returning empty strin. please in reading right value. thank in advance

sql - how to get rows value in one row? -

select id x gives list of ids: 1 2 3 44 655 31 how in 1 row array? (1,2,3,44,655,31) query should this select string_agg(id, ',') x

c# - Proper way to avoid duplicating test data for unit tests -

lets have following unit test entity framework 6 using moq: public void save_employee_via_context() { var mockcontext = new mock<dcmdatacontext>(); var mockset = new mock<dbset<employee>>(); mockcontext.setup(m => m.employees).returns(mockset.object); var service = new generalservice(mockcontext.object); //test valid inputs (int = 0; < testdata.validemployees.count; i++) { service.addemployee(testdata.validemployees[i]); //veryfy inserted assert.areequal(testdata.validemployees[i],mockset.object.find(testdata.validemployees[i].employeeid)); } //ensure proper methods called each time. implied happened if above //assert methods passed, double checking never killed mockset.verify(m => m.add(it.isany<employee>()), times.exactly(testdata.validemployees.count)); mockcontext.verify(m => m.savechanges(), tim...

ios - SVG background image not appearing on iPad -

i'm having strange problem background on site. i'm using multiple background images; there's 4 photos , svg of angled shapes goes overtop of images , frames them. css body background body { background-color: #bbe2de; background-image: url('/img/mobile-bg-exorcised.svg'); background-position: top center; background-repeat: no-repeat; color: #2a2a2a; font-family: "ff-din-web"; font-size: 16px; line-height: 1.4em; } @media screen , (min-width: 600px) { body { background: url('/img/desktop-bg.svg') top left, url('/img/bg-photo-4.jpg') 849px 4460px, url('/img/bg-photo-3.jpg') 0 3948px, url('/img/bg-photo-2.jpg') 617px 980px, url('/img/bg-photo-1.jpg') 0 186px; background-repeat: no-repeat; } } it displays on desktop browsers, on ipad svg doesn't show @ all. rest of images show fine. i'm us...

java - How to implement MyClass<T extends OtherClass> in C++? -

can tell me how implement java-code in c++? public class myclass<t extends otherclass>{ .... } i've tested in c++: template<class t, class otherclass> class myclass { public: myclass(); } but i've error: invalid use of template-name 'myclass' without argument list greetings you can use std::is_base_of in combination static_assert : template<class t> class myclass { static_assert( std::is_base_of< otherclass, t >::value, "t not extend otherclass"); public: myclass(); }; (you can, of course, make otherclass additional template parameter in case need more flexible)

objective c - how do i output the contents of an array line by line to a uitextview? -

i have array of items (for excercise order line items), strings inserted line line array. how can display contents of array in textview without brackets or commas of array each line? guess along lines of iterate through array , each object take value, convert string , add line break , add string main mutable string , set textfield contents of mutable string. know how iterate array code , insert line breaks. how this? if elements of array strings @ beginning of post, gets want. yourtextfield.text = [yourarray componentsjoinedbystring:@"\n"]; each element in array have 'description' called on during joining process. nsstrings return description, if elements of array type created consider overriding 'description' format want.

ab testing - Sample size for google content experiment -

can give me idea kind of traffic / sample size need statistically significant result when doing google content experiement 2 variations? google uses multi armed bandit testing. here article on googles answer the best way in practice watch percentage in google analytics experiments tab , see how moves toward 95%. you can't exact answer because changes take measurements , based on difference trying measure. if 1 variation performs 300% better other take lot smaller sample size if 1 variation performs 10% better other. to see how math straight statistical significance works here explanation. statistical significance tutorial here spot has calculator calculator as far math multi armed bandit quote peter whittle sums up [the bandit problem] formulated during [second world] war, , efforts solve sapped energies , minds of allied analysts suggestion made problem dropped on germany, ultimate instrument of intellectual sabotage.

Some clarifications about Adapter pattern applied to Swing events in Java -

i studying java swing , how handle event using adapter pattern not override of methods handle event. i have found short example , want know if have understand it: import java.awt.event.windowadapter; import java.awt.event.windowevent; import javax.swing.jframe; public class sketcher { jframe window = new jframe("sketcher"); public sketcher() { window.setbounds(30, 30, 300, 300); window.addwindowlistener(new windowhandler()); window.setvisible(true); } class windowhandler extends windowadapter { public void windowclosing(windowevent e) { system.out.println("closing"); window.dispose(); // release window resources system.exit(0); // end application } } public static void main(string[] args) { new sketcher(); } } what have understand is: the sketcher class contains main method creat new sketcher instance. a sketcher instance create new jfr...

sql - Using MySQL Partitioning to speed up concurrent deletes and selects? -

i have mysql innodb table contains 8.5 million rows. table structure looks this: create table `mydatatable` ( `ext_data_id` int(10) unsigned not null, `datetime_utc` date not null default '0000-00-00', `type` varchar(8) not null default '', `value` decimal(6,2) default null, primary key (`ext_data_id`,`datetime_utc`,`type`), key `datetime_utc` (`datetime_utc`) ) engine=innodb default charset=utf8; every night, delete expired values table following query: delete mydatatable datetime_utc < '2013-09-23' this query not seem use indizes, , takes quite time run. concurrent updates , selects on same table. these locked then, causing website unresponsive @ time. i looking various ways speed setup. cam across mysql partitioning , wondering if fit. adding , selecting newer data table , deleting old ones. create partitions based on mod(dayofyear(datetime),4). when delete, delete values partition 1 reading or writing from. will experience lock...

Rollback a Webdeploy publish in ASP.NET MVC -

i have web deploy setup code first migrations executed on publish mvc project. there way rollback publish if screw up? can write unit , integration tests until blue in face inevitably bug or error through. better rollback changes try , fix error while live site down. have ruby on rails project deploy using capistrano. has handy "cap deploy:rollback" command use regularly. need mvc project. what want create specific branches , tags in source control deploy off of tags. if want deploy previous version checkout branch/tag , deploy that. you can run migration using script. update-database -targetmigration:0 just modify deploy script call latest version of migrations on branch. taking these few steps allow deploy branch/tag want , production environment in sync. note: caveat whether migrations can destructive.

hadoop - Ubuntu GNOME Terminal - Can't move cursor to previous line when writing PigLatin/ Hive Commands -

i trying write long pig latin command in grunt shell, spills on second line. in order correct error in line 1, when try move cursor using left arrow key, cursor gets stuck @ beginning of line 2 , not move line 1. is there way can overcome issue? i working on cloudera demo vmware 0.3.7 hadoop, pig , hive pre-configured. also, please let me know if need post more details.

jdbc - Categorizing data from DB2 -

i using jdbcquery datasource extension library data view control pull db2 data , page throws error 500 when use db2 column names in categorycolumn and/or summarycolumn columnname or value properties, not extracolumns. can understand why might occur categorycolumn because db2 column isn't categorized, have thought db2 columns considered summary columns. anyway, there control can use or hack method make columns appear categorized when column datasource isn't? domino 8.5.3fp3 extension library 9.0.0.v00_02_20130515-2200 db2 v10.1 z/os i think category bean project might help. @ least can make own bean based on it.

gimp - python can't import gimpfu -

i'm trying write gimp script using pythonfu. however, when try run script locally, error `--> ./vvv.py traceback (most recent call last): file "./vvv.py", line 5, in <module> gimpfu import * importerror: no module named gimpfu i gather script might loadable through gimp. however, script doesn't appear @ gimp menus. in case, how error output? depending on os, have gimp plugin's directory, like: gimp 2\lib\gimp\2.0\plug-ins and copy script there. of course have add registration stuff this: register( "python-fu-draw", #<- plugin name n_("brief"), #<- description "long", #<- description "name surname", #<- author "@copyright 2013", #<- copyright info "2013/10/29", ...

sql - MySQL create table with german date format for 2013 -

i have mysql snippet: create table mydates ( mydate date ); create procedure filldates(datestart date, dateend date) begin while datestart <= dateend insert mydates (mydate) values (datestart); set datestart = date_format(date_add(datestart, interval 1 day), '%d.%m.%y'); end while; end;// call filldates('01.01.2013','31.12.2013'); here try create table every day of year not work. without specific date format works well. link: http://sqlfiddle.com/#!2/4ae5c i believe may looking str_to_date() function. try like str_to_date(@dateingermanformat, "%d.%m.%y") mysql docs

asp.net - Link to a New .aspx Page from Selected Database Entry by User -

i working on website using c# in asp.net , have page contains grid-view displays contents of 1 of tables in database. fields generic name, description, rating, ect. question how make when 1 of entries clicked, links new .aspx page has information displayed in nice format? example of talking can found @ http://www.imdb.com/chart/top?ref_=nv_ch_250_4 . from research have found little in way of answer, due inability ask question correctly. assume not suppose physically create new page every new entry, because crazy if have lots of database entries coming in. should there 1 page created auto-populates required fields based on specific values passed database entry selected, or when user inserts new entry database should create new .aspx page? question has had me stuck quite time, appreciate direction can provide! create simple hyperlink rows of grid, url of hyperlink should contain reference item id or name. when link clicked passing id second page in querystring. in second ...

java - Output a row to Cassandra in Hadoop Mapreduce -

i write row cassandra in reducer , following 2 word count examples provided cassandra ( an example using cql3 , an example using mutation ), both outputing single column given key. can know how output row (i.e, multiple columns) known key in reducer using either cql3 or mutation? you need @ cqlconfighelper.setoutputcql which can use cql string has multiple replacements in it. detailed here: https://stackoverflow.com/a/19035392/33

ldap - ldapmodify: invalid format (line 5) entry: " ... " on LDIF (passed from PHP) -

i'm attempting write bit of code allow users change expired active directory passwords via php web interface. due limitations php's ldap library's*, seems way generating ldif , passing directly ldapmodify. the code i've come (minus vars) is: ldapmodify -h {$ad_server} -d '{$dn}' -w {$old} <<! dn: {$dn} changetype: modify delete: unicodepwd unicodepwd:: {$oldpassword} - add: unicodepwd unicodepwd:: {$newpassword} - ! the code appears work fine when paste generated code straight in console, far i've had no luck running php. i tried passing code exec , exitcode 247(which doesn't appear real thing) i attempted use proc_open instead, provided current error ldapmodify: invalid format (line 5) entry: " ... " so far can see thing on line 5 "-". i'm bit stuck wrong. p.s. read post ldif file error?? invalid format? reported similar problem, although assuming encoding of "-" character issue, i'm not ...

javascript - Live data not submitting using MVC 4.5 unobtrusive validation -

we have form user can move items 1 multi-select box another. using mvc 4.5 , jquery validate microsoft's unobtrusive javascript. the problem is, when submitting form, values within select boxes don't submitted because user doesn't know after moving items have select items submission. so solution sounds easy: use jquery select items upon submit. after doing research (thanks stackoverflow community), able discover necessary jquery code intercept submit process. however, problem arises in when code selects items, pre-existing items in select box selected. live (dynamic) items have been moved not selected. here code first used: $('#userprofileform').bind('invalid-form.validate',function(){ $(this).find('.selectbox option').each(function (i) { $(this).attr("selected", "selected"); }); }); we discovered using bind doesn't work live should: $('#userprofileform').live('invalid-form.validat...

opengl - set raster color for glutBitmapCharacter, when using shaders -

i'm using vertex , fragment shaders, glsl version 130. ubuntu 12.04 lts. shaders work ok. lighting disabled. text drawn ok glutbitmapcharacter(), in unpredictable color. when tweak palette used shaders , recompile, color changes. glcolor4f() has no effect of course, shaders override fixed pipeline behavior. how can set "raster color" glutbitmapcharacter() render in? (or should each frame use shaders , then fixed pipeline? yuck.) please speak me: i not mix opengl raster operations programmable pipeline. found out result quite, err, annoying. also raster operations have been removed entirely modern opengl (i.e. above, including opengl-3.0). trying use them shaders pure masochism. , hurts watch other people trying it. please don't. or should each frame use shaders , fixed pipeline? you can switch between fixed function , shaders @ time. use gluseprogram(0) switch fixed function when need it. when using raster operations. you're of ...

c# - Update MVC database first to reflect db changes -

i'm new mvc , have update model. i have sql server database connected project, today add new column. need update mvc code reflect change. everything online tells me update .edmx , .tt files update model wizard since auto generated, cannot find wizard in vs 2012 @ stand still. is right way should doing this? tips great...thanks there couple options can do: if database empty or there isn't lot of data care about, can drop database , recreate it. manually add column in database (after property in model) there called code first migrations. allow update database. here tutorial can @ this: http://msdn.microsoft.com/en-us/data/jj591621.aspx

ruby - Method undefined for modules in rails 4? -

file structure: ../controllers /api /v1 users_controller.rb some_controller.rb inside users_controller.rb module api module v1 class userscontroller < applicationcontroller def create return false end end end end i can include api in controller , api::v1::userscontroller. however, when try api::v1::userscontroller.create in controller error: undefined method `create' api::v1::userscontroller:class i've tried doing modules in lib, rails 4 autoloading being weird tried doing way, don't know why methods undefined. when go console , puts api::v1::userscontroller.methods.sort, :create method isn't there. doing wrong? create not class method. can't called class.method . you need instance of class call it. if want try(though not way controller work) api::v1::userscontroller.new.create

PHP Regex: How to match \r and \n without using [\r\n]? -

i have tested \v (vertical white space) matching \r\n , combinations, found out \v not match \r , \n . below code using.. $string = " test "; if (preg_match("#\v+#", $string )) { echo "matched"; } else { echo "not matched"; } to more clear, question is, there other alternative match \r\n ? pcre , newlines pcre has superfluity of newline related escape sequences , alternatives. well, nifty escape sequence can use here \r . default \r match unicode newlines sequences, can configured using different alternatives. to match unicode newline sequence in ascii range. preg_match('~\r~', $string); this equivalent following group: (?>\r\n|\n|\r|\f|\x0b|\x85) to match unicode newline sequence; including newline characters outside ascii range , both line separator ( u+2028 ) , paragraph separator ( u+2029 ), want turn on u ( unicode ) flag. preg_match('~\r~u', $string); the u ( unicode ) m...

css - How do you float divs to the left? -

Image
i'm trying better html coder, have decided away table layout. , use div layout instead, i'm getting issues positioning stuff using divs. on page i'm trying add 3 images , text them, won't align using float, instead cascading. here's markup: <style> .left { float: left; } </style> </head> <body> <div class="left"> <img src="images/image.jpg" alt="" class="left" /> </div> <div> text </div> <div class="left"> <img src="images/image.jpg" alt="" class="left" /> </div> <div> text </div> <div class="left"> <img src="images/image.jpg" alt="" class="left" /> </div> <div> text </div> </body> im hoping 1 of can point problem, (help! dont...

java - How do you avoid concordion:run running tests twice -

using concordion, possible create "index" fixtures use concordion:run command run test. e.g. <a concordion:run="concordion" href="mylengthytest.html">the lengthy test</a> my tests set use springjunitrunner per tip here . i tried excluding fixtures failsafe plugin, including runner calls them i.e. <includes> <include>**/*test.java</include> <include>**/*fixtureindex.java</include> </includes> <excludes> <exclude>**/*fixture.java</exclude> </excludes> where in case "fixture" files fixtures , "fixtureindex" index file concordion:run statements. seemed reasonable approach, still seems run tests twice.. bizarrely. i found question elsewhere , no useful answers given, having struck the exact same problem...

c# - HTTP to HTTPS silverlight wcf cross domain issue -

i've been looking on site , on stack overflow , can solve issue. network setup the way network on staging world have clients looking @ web app on 443 port - https, underlying structure listening on 80 port - http. when apps talk each other on port 80, when clients visit site port 443. example, svc called silverlight on port 80. i should point out on staging , test domains: have web server acting portal app server; shouldn't matter since able working on test. it's staging has http forwarding https. application i have silverlight xap file on same domain hosted web application using iis 6. now since silverlight xap file , web application on same domain, have no problems running on dev , test, when try deploy staging i'm getting weird cross domain reference problem: "system.servicemodel.communicationexception: error occurred while trying make request uri . due attempting access service in cross-domain way without proper cross-domain policy in place, o...

python - How can I quickly find the first element in a list that matches a conditional? -

i have 2 subroutines in large program search list first item matches condition , return index. reason, these take large percentage of program's execution time, , wondering how optimize them. def next_unignored(start_index, ignore, length): """takes start index, set of indices ignore, , length of list , finds first index not in set ignore.""" in xrange(start_index+1, length): if not in ignore: return def last_unignored(start_index, ignore, lower_limit): """the same other, backwards.""" in xrange(start_index-1, lower_limit-1, -1): if not in ignore: return does have tips on optimizing these routines or others follow similar pattern? example input: from sample import next_unignored, last_unignored start_index = 0 ignore = set([0,1,2,3,5,6,8]) length = 100 print next_unignored(start_index, ignore, length) # => 4 start_index = 8 ignore = set...

android - When is an activity paused without soon after being stopped? -

so i'm looking @ trying understand android's activity lifecycle. 1 thing don't quite see when activity paused without being stopped afterwards. documentation can find says this this method [onpause] called when system put activity background or when activity becomes partially obscured. when activity become partially obscured? onpause called when activity still in fg visible , running obscured such when start dialog activity still running in fg , visible obscured dialog, onpause. onstop when in bg such turned new activity or so, still active , running untouchable , not visible. in nutshell

c# - Set Options Menu Visibility always On. (Android, Xamarin, MVVMCross) -

i wondering if there way keep android options menu programmatically permanently visible. if try understand question, strange thing do. if want menu visible time, has nothing options menu. create (sub)view/layout menuitems want use. also remember options menu can work differently between android versions, , device vendors funny things options menu, influence way app behaves.

Issue with CQ5 Workflow -

i've developed workflow model looks below. flow start ->test process-> custom participant ->end i've written 2 different osgi bundle 2 different custom process step , custom dynamic participant step. first osgi implemetation - created bundle under /apps/mywebsite/wfprocess/ , path of java file /apps/mywebsite/wfprocess/src/main/java/com/test/workflow/myworkflowprocess.java @component @service public class myworkflowprocess implements workflowprocess { @property(value = "an example workflow process implementation.") static final string description = constants.service_description; @property(value = "adobe") static final string vendor = constants.service_vendor; @property(value = "custom step process ") static final string label="process.label"; private static logger log = loggerfactory.getlogger(myworkflowprocess.class); private static final string type_jcr_path = ...

javascript - Showing info when clicking on specified text -

i'm dutch boy own website , i'm kind of new programming. know little basic html, knowledge stops there. wanted create on page offer services computer , more. on left want have services listed , on right info service. don't want info on right, want appear , disappear when click service on same page. when no service clicked, want have text explanation services , more. want possibility change info , add images , html plugins. think possible html5 (or javascript, maybe jquery) don't know how. want test it: http://webguideict.com/test/ website running on wordpress , might slow because of hoster have (bluehost), i'm doing on own , cheap, know why. there programmers can , want me problem? preferably pre-written code or simple explained, love learn! in advance! thomas your specific question sounds jquery/javascript. see jsfiddle example html: <h2>services:</h2> <ul> <li id="con"> consulting </li...

mvvmcross - How do I write the code once, then link to existing XCode or Android project? -

i'm interested in mvvmcross means of developing library can compiled , linked existing ios , android project. is possible using mvvmcross. library contain models persistence / data access code web service calls business logic is possible? cheers tobin if want that, difficulties doesn't justify effort. it's easier if rewrite ios , android xamarin. 'rewriting' has bad reverberations, in ear of boss, due how xamarin works, it's easier might think, here why: if plan use xamarin , mvvmcross build shared core project , use in existing xcode , android projects (assuming technically possible) have strip out pretty of implementation existing projects , move xamarin mvvmcross core project. your existing xcode , android projects remain ui. similar re-writing apps xamarin, because xamarin build ui using same native tools had. if want use xamarin, best think recreate ios , android apps xamarin. have ui done , can port easily, there's n...

java - LWJGL with Slick-Util use a lot of RAM to load texture -

if use slick-util load textures lwjgl uses lot of ram. here example console-output: message.info ((runtime.getruntime().totalmemory() - runtime.getruntime().freememory()) / 1000000 + "mb"); texturemanager.loadtexture("gui.wallpaper", "resources/wallpaper.jpg"); message.info ((runtime.getruntime().totalmemory() - runtime.getruntime().freememory()) / 1000000 + "mb"); the "texturemanager.loadtexture(...)" method following: string texturefileformat; if (thepath.contains("png")) { texturefileformat = "png"; } else if (thepath.contains("jpg")) { texturefileformat = "jpg"; } else if (thepath.contains("jpeg")) { texturefileformat = "jpg"; } else { texturefileformat = "png"; } thetexture = textureloader.gettexture(texturefileformat, new fileinputstream(thepath), true); // === store onto hashtable === // textures.put(thename, thetexture); this uses...

extjs4 - How to force extjs grid to save state -

if user changes column size, grid statemanager saves state of grid. if provide reset button , use grid.reconfigure() state not saved. how force grid issue state save reconfigure? you can use grid.initstate() after reconfigure. below. grid.reconfigure(store, columns); grid.initstate(); eventhough initstate() can not find on ext js documentation works ver 4.2 hope helps

vb.net - Adding items from textbox to a list(of string) -

i`m new vb.net. looking find out how add items list. @ moment,its adding 1 item. need save many items , must able display items in textbox. please help! public class form1 private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click dim patients list(of string) = new list(of string) patients.add(textbox1.text) textbox2.text = patients.count end sub end class every time click button new copy of list variable created and, of course, empty. add 1 item that's end of game. if want preserve contents of list, need move list variable @ global class scope public class form1 dim patients list(of string) = new list(of string) private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click patients.add(textbox1.text) textbox2.text = patients.count end sub ..... end class

jQuery UI droppable outside the visible area of a jScrollpane catches drop event -

i have 2 adjacent jscrollpanes contain droppable li elements. first div above second (on y-axis), overflow top 1 flows "under" 1 below (both overflow:hidden). problem when drop draggable element lower jscrollpane, event caught droppable elements in both upper , lower, though element in upper outside of visible area of container. how prevent "hidden" elements (those outside of scrollpane) catching drop event? i've tried inserting logic test if droppable :hidden or :visible, didn't work. playing z-index didn't work either. wanted delegate droppable() handler container, rather have on li, that's not supported. i solved problem using this answer , modifying work jscrollpane. difference there 2 different parents need take consideration. size of "parent" referenced in other solution can gotten $(this).closest(".jspcontainer") , need take account offset of viewable region. if you're scrolling vertically, offs...

r - Converting list of varying-length elements to dataframe -

consider following list of vector elements varying length: test = list(c(a = 1, b = 2), c(a = 3, c = 1), c(a = 9), c(a = 6, b = 7, c = 8)) i convert list dataframe, while matching names of elements in following fashion: # b c # 1 2 na # 3 na 1 # 9 na na # 6 7 8 any appreciated. thanks! library(plyr) rbind.fill(lapply(test, function(x) as.data.frame(t(x)))) # b c #1 1 2 na #2 3 na 1 #3 9 na na #4 6 7 8

scanf - using fscanf in C with varying width files -

i need write program reads in various files , stores information arrays. using doubles perform matrix multiplies. regarding format of files; first line contains size of matrix. next several lines rows of matrix, each element separated space. format: <number of rows> <number of columns> <double> <double> ... <double> <double> <double> ... <double> . . . <double> <double> ... <double> here couple example files: 3 4 1.20 2.10 4.30 2.10 3.30 3.10 5.20 2.80 1.10 0.60 4.70 4.90 or 5 5 1.20 2.10 4.30 2.10 6.70 3.30 3.10 5.20 2.80 3.20 1.10 0.60 4.70 4.90 9.10 3.30 3.10 5.20 2.80 3.20 1.10 0.60 4.70 4.90 7.10 at moment code follows: float** readfile(char* fp) { float** matrix = (float**)malloc(m*n*sizeof(float)); fp = fopen(fp, "r"); if (fp == null) { fprintf(stderr, "can't open file\n"); exit(1) } int = 0; int m, n; fscanf(fp, "%...

wro4j with orange wro4j-taglib - sometimes loading wrong group? -

we're using wro4j orange wr4j-taglib, , when deploy loading same resource twice instead of 2 different ones, not on servers. below snippet our groups in wro.xml . we're using build time solution, hashes property file , concatenated files being generated @ build time. <group name="insertimagecore"> <js>/static/js/imageinsert/js/imageinsert.js</js> <js>/static/js/imageinsert/js/util/imageinsertutils.js</js> <js>/static/js/imageinsert/js/util/imagedao.js</js> <js>/static/js/imageinsert/js/util/servicecalls.js</js> <js>/static/js/imageinsert/js/util/search.js</js> <js>/static/js/jquery.ux.thumbgrid.js</js> <js>/static/js/jquery.ux.statemanager.js</js> <css>/static/css/jquery.ux.thumbgrid.css</css> <css>/static/css/jquery.ux.statemanager.css</css> </group> <group name="insertimage"> <group-...

c# - SQL CONVERT function working in SQL Server but not in application -

i have following code: … var sqlcom = new sqlcommand("select top 1 …,convert(date,dtetme) dtetme… class c id=@id;", sqlcon); … try { while (sdr.read()) (int = 0; < 11; i++) rslt[i] = sdr.getvalue(i).tostring(); } the column dtetme of type smalldatetime in sql server 2012 database. want extract date that’s why using convert(date,dtetme) function. when run on sql server, returns date expected, in application returning default timestamp attached. don’t want this: 9/19/2013 12:00:00 am . any idea why working in sql server , not in application? a date date date. not string. should read as date , , format choose afterwards. database, date number - has no notion of format. so: var when = sdr.getdatetime(i); // format when

twitter - How to check rate_limit_status in response header in C# -

we see our rate limit being reached in our twitter calls, did research: https://dev.twitter.com/docs/rate-limiting/1.1 they suggested checking rate_limit_status once in while explained here: https://dev.twitter.com/docs/api/1.1/get/application/rate_limit_status so, know how check in code. can this? string ratelimit = twitterservice.response.headers["application/rate_limit_status"]; my questions are: do parse ratelimit? because json/xml according api, contains "remaining": "reset": "limit": so, let's want reset rate limit once hits closer limit, should do? any appreciated. do parse ratelimit?because json/xml yes, example using json.net . if want reset rate limit once hits closer limit, should do? you can't wait until reset moment, it's timestamp.

.net - Can't handle exception Errorstatus.EInvalidKey in Autocad -

ok, usual autodesk has little no documentation on subject i'm trying glean seniors here. i'm attempting write bit of code perform wblock operation on list of xrefs in file. when try go through wblock process though autocad raises error stating there's invalid key. have no idea how handle particular exception , autodesk has no documentation on it. have ideas? foreach (blocktablerecord x in xlist) { ...... //if xref doesn't exist... if (!file.exists(path.combine(filepath, newxrefs, xrname))) { try { //write file out base location same name database xdata = x.getxrefdatabase(true); database newxref = adbase.wblock(x.objectid); newxrpath = path.combine(filepath, newxrefs, xrname); newxref.saveas(newxrpath, dwgversion.ac1021...

C struct declaration and initialization -

i have been following tutorials web on creating struct , initializing in main(). tutorials have followed, have created own example, follows: #include <stdio.h> struct test { int num; }; main() { test structure; } however, not work: test.c: in function 'main': test.c:8: error: 'test' undeclared (first use in function) test.c:8: error: (each undeclared identifier reported once test.c:8: error: each function appears in.) test.c:8: error: expected ';' before 'structure' but when change: test structure; to: struct test structure; the code compiles. why though? numerous examples have looked @ seems shouldn't need 'struct' before 'test structure'. thanks help/comments/answers. you reading c++ examples. in c type of structure struct test not test .

CSS3 animation firing just once in Firefox using Jquery add/remove class events -

i've run across number of posts here detailing problems css3 animations not working in firefox, 1 animation fires once: firefox runs css animation once and documented bugs of firefox/jquery/css animations together? but these fixes not relevant issue. i've got these animations working in safari/chrome, , have correct vendor prefixes css (even though firefox shouldn't need them). i'm using jquery add / remove class events trigger animations, , can see in firebug classes changing when expect them to. the issue animation fires first time, never again, , defaults making panel disappear , reappear css: /* custom sliding panel */ @-webkit-keyframes panelslideleft { { opacity: $panelopacitystart; -webkit-transform: translatex(0); } { opacity: $panelopacityend; -webkit-transform: translatex($panelwidth); } } @-moz-keyframes panelslideleft { { opacity: $panelopacitystart; -moz-transform: transl...

java - Delete End Node to a relationship with neo4j cypher query -

i using spring neo4j , java. have @nodeentity on classes wish persist. in of these classes, have data members annotated @relatedto , @fetch . want able delete 1 of classes containing @nodeentity , delete data memembers connected vi @relatedto , @fetch annotations. have created delete query in attempt delete node , nodes connected via relations: @query("start n = node:uid(uid={0}) " + "match n-[*]-x x match x-[r]-() " + "delete x,r") public void deletebyuid(string uid); this deletes top level node , relations, leaves behind nodes connected via relationship top level node. how can modify query cypher? you might want try @query("start n = node:uid(uid={0}) " + "match n-[*0..]-x x match x-[r]-() " + "delete x,r") public void deletebyuid(string uid); since * defaulting [*1..] .

jquery - Autocomplete returning 500 error -

i having problem getting search form autocomplete in mvc4 razor, using jquery , ajax. my html form @using (html.beginform()) { @html.textbox("frienslist") <input type="submit" value="go" /> } my js script $(document).ready(function () { $("#frienslist").autocomplete({ source: function(request,response) { $.ajax({ url: "/user/friendlist", type: "post", datatype: "json", data: { term: request.term }, success: function (data) { response($.map(data, function (item) { return { label: item.label }; })) } }) }, minlength: 1, delay: 1000 }); }) and controller public actionresult friendlist(string term) { using (var db = new dbcontext()) ...

Facebook SDK for Xamarin.iOS login return issue -

i'm trying use facebook sdk xamarin.ios(the 1 facebook, not octorcurve) users authed on app. i've followed sample comes component store. sample works i'm stuck after login/permissions without firing events notify viewcontroller have user logged in. have set plist file app name, id, , url schema requested facebook sdk. so, code is: note i'm not creating ui code. have .xib ib file ui , yes, added view fbloginview , set custom class fbloginview. appdelegate.cs(omitted rest of code brevity): public override bool finishedlaunching (uiapplication app, nsdictionary options) { // create new window instance based on screen size window = new uiwindow (uiscreen.mainscreen.bounds); viewcontroller = new loginviewcontroller (); navcontroller = new uinavigationcontroller (viewcontroller); window.rootviewcontroller = navcontroller; window.makekeyandvisible (); return true; } public override bool openurl (uiapplication application, nsurl url, ...

c++ - Convert a string with various float numbers into floats. -

i have series of strings "50 50 10" each number supposed represent x, y, , z values of origin. want convert each number of string actual float. i tried using atof, gave me first number, 50 in case. any ideas? thank you! use istringstream, int main() { string s = "50 50 50"; istringstream instream; instream.str(s); double a, b, c; instream >> >> b >> c; return 0; }

php - Line breaks not going through -

alright site allowing users have description of or whatever like, when attempt make breaks using [enterkey] <textarea> looks this: hello, john smith. phone#: (123)456-7890 enjoy web-browsing. when return page looks same (it puts current description in edit box). want. in php database , still looks same. again want. on profile page looks this hello, john smith. phone#: (123)456-7890 enjoy web-browsing. it contained inside div these style tags , so <div style="width: 250px; min-height: 50px; margin: auto; font-weight: normal; text-align: center; padding: 2px; margin-bottom: 5px;"> <?php echo $description; ?> </div> im curious why appreciated :d. add white-space:pre-line <div> or, use: <?= nl2br($description); ?> remember html needs <br /> line breaks, not \n or \r\n (like <textarea> collecting). can either tell html pay attention new lines using white-space , or force...

javascript - useUTC don't work -

i'm trying have correct time on charts if use useutc = false in code : success: function(data) { var options= { chart: { renderto: 'rendu_graph<?=$instance_graph?>', type: 'spline' }, global: { useutc: false }, title: { text: 'graph des relevés des sondes' }, subtitle: { text: '' }, xaxis: { type: 'datetime' }, yaxis: { title: { text: '' } }, tooltip: { formatter: function () { return '<b>' + this.series.name + '</b><br/>' +highcharts.dateformat(...

android - Dynamically creating a tile for a TileProvider -

i want create heat map on android , trying generate tile return gettile, can't find dynamically generating large image smaller 1 copied bunch of times. there tutorials or code snippets this? also, if isn't way go let me know well. since i'm dynamically generating tile can't use urlprovider, can't find single example of generating tiles dynamically. if want create bitmap bitmap cropping, resizing, etc, you're gonna want use canvas: canvas canvas = new canvas(resultbitmap); //result bitmap end drawing. canvas.drawbitmap(otherbitmap, areafromotherbitmaptocopyrect, areainresultbitmaptodrawrect, paint); the 2nd , 3rd parameters there rects inside the source bitmap (from you're copying part or whole image), , result bitmap (to you're drawing image). however, if you're drawing heat-map, might find easier draw small rectangles of colors instead of copying other bitmaps (which computationally harder). create canvas in same way, instead of...

java - passing values from a class to another callable class -

i have class below code, public class doctransformer implements callable<indexabledocument> { wdoc document; public doctransformer(map<indexfield, tokenizer> tknizermap, wdoc doc) { this.document = doc; } public indexabledocument call() throws tokenizerexception { system.out.println("inside doctrans: "+this.document.getid()); } } the indexabledocument looks below, public class indexabledocument { wdoc doc; public indexabledocument() { system.out.println("this inside indexable document"); } public void addfield(indexfield field, tstream stream) { //todo: implement method } public tokenstream getstream(indexfield key) { //todo: implement method return null; } public string getdocumentidentifier() { system.out.println(doc.getid); } } a runner class calls doctransformer. can access wdoc inside doctransformer being called runner...

Is SQL Azure Data Sync Production Ready? -

i want start using sql azure , sql azure data sync (for both on-premises sql 2008 , azure). the azure portal still labels data sync 'preview' - production ready? if not when be? anything labeled "in-preview" considered not supported production use, though may opt so; realize not recommended. timing, suggest keeping tabs on sql team's blog: http://blogs.technet.com/b/dataplatforminsider/

Batch File for creating Active Directory, User Home folders -

Image
so created batch script create ou's, groups , users csv file. have set in script create home directory every user creates; have following in code: mkdir d:\homedirs net share homedirs=d:\homedirs /grant:everyone,full dsadd user cn=user1,ou=ou1,dc=server,dc=.com -hmdir "\\mycomputer\homedirs\user1" -hmdrv h: the first 2 lines create folder , make share , 3rd line create users network share settings set in active directory, seen in screen shot below. now settings correct home folders not created automatically. if go profile tab manually seen in screen shot , hit apply create home directory in right spot no changes beside going each user , selecting apply. any idea how can automatically ?

wordpress plugin - Remove original image after automatic creation of featured image -

i installed plugin http://wordpress.org/plugins/automatic-featured-image-posts/ having problemm, because plugin doesn't remove original image post content after creating featured image. (and therefore when don't add featured image there appear 2 images on post) tried adding auto-featured-image.php add_action('publish_post', 'eliminaroriginal'); and then function eliminaroriginal(){ //update post without image $post_parent_id = $post->post_parent === 0 ? $post->id : $post->post_parent; $contenido = preg_replace("/[caption .+?[/caption]|\< [img][^>] [.]*>/i", "", $post->post_content, 1); $mipost = array(); $mipost['id'] = $post_parent_id; $mipost['post_content'] = $contenido; wp_update_post( $mipost ); } but didn't have result. please me, don't know should do. thank before hand!