Posts

Showing posts from June, 2013

javascript - PHP & Jquery Ajax, json, get data in the ajax destination file -

i need send array in php trough ajax different server, trying following. array encoded json_encode : [ {"id":"1","name":"avocado toast tartine","qty":"1","price":"88.00","spec":""}, {"id":"16","name":"add berries","qty":"1","price":"48.00","spec":""} ] so in origin file have: <script> var cart = <?php echo $cart; ?>; //this array above $.ajax({ url: 'https://www.mydestinationurl.com.hk/new/admin/do_lpq_order.php', crossdomain: true, type: 'post', data: cart }).done(function(data) { console.log(data); }); </script> and in destination file have this: <?php switch ($_server['http_origin']) { case 'http://localhost': case 'https://...

managing multiple values in android -

i doing project on ecommerce app. in dashboard activity getting username value login activity , mobile number main activity. want check 2 values , set in text view according incoming values. how can achieve? you either store them in sqlite database or similar, or store them in sharedpreferences . you can more options here

Why does this JavaScript code make the entire array point to the same object? -

in book javascript: parts , there code on page 64: for (i = 0; < n; += 1) { my_array[i] = []; } // note: array.dim(n, []) not work here. // each element reference same // array, bad. why each element in array point same object? seems me line my_array[i] = []; reevaluated each loop, causing new empty object created. what're rules of getting reference same object versus new one? how make different empty array every loop? edit: reading people's responses, read paragraph wrong. answers! this loop new reference each time. run it, mutate 1 of arrays , you'll see 1 changes. the problem more array.dim method. imagine it's implemented this: array.dim = function(n, init) { var arr = []; var i; (i = 0; < n; += 1) { arr[i] = init; } return arr; } using literal array syntax create new reference array, method uses same reference populate each value of resulting array. it might easiest compare 2 way. var init = []; (i = 0; < ...

bytebuffer - Read and write to a particular line in large textfile java -

i'm using stream read particular line file , of pre-calculated byte position value i'm using filechannel , bytebuffer write same location in big file. editing values in textfile. //read particular line stream<string> lines = files.lines(paths.get('pathtofile')); string text = lines.skip(linenumber).findfirst().get(); // modify text example text.replace("r",r); // re-write same position after manipulating same text randomaccessfile file = new randomaccessfile('pathtofile', "rw"); filechannel channel= file.getchannel(); bytebuffer buf = bytebuffer.allocate(50); buf.put(text) buf.flip() channel.position(pre_calculated_position); while(buf.hasremaining) channel.write(buf) channel.close(); buf.clear(); file.close(); i'm wondering if there cleaner or better way same without reading line line? thanks

c# - How to prevent Unity overwriting existing mappings with AutoRegistration -

unity 3 offers new capabilities autoregistration (registration convention) such as: container.registertypes( allclasses.fromloadedassemblies(), //uses reflection withmappings.frommatchinginterface, //matches interfaces implementations name withname.default); this code register types implement named interfaces, against interfaces. example, class myservice : imyservice registered automatically though had written following: container.registertype<imyservice, myservice >(); my question: if want of time, want choose different implementation 1 of interfaces, though named implementation exists? see: patterns , practices on codeplex an important article read explaining why want jeremy miller's convention on configuration article what stops overriding automated mapping custom set loaded configuration (which - if empty - means no default mapping overridden): // have auto registration container.registertypes( allclasses.fromloadedassemblies...

c# 4.0 - devenv /runexit command does't closes visual studio instance? -

i'm in process of automating applications. i'm using... devenv.exe /runexit "solutionfile\path\filename.sln" i'm running applications. if exceptions occurred in above process, visual studio doesn't exit , automation returns success. i've searched other command line switches couldn't found solution this. please share solutions this?

MATLAB "Subscript indices must either be real positive integers or logicals" -

in matlab examples page computer vision system toolbox, there code object detection in cluttered scene using point feature matching. running same code on system, giving error "subscript indices must either real positive integers or logicals" code tries match similarity between 2 images. i1 = rgb2gray(imread('kitchen.jpg')); i2 = rgb2gray(imread('loops.jpg')); points1 = detectsurffeatures(i1); points2 = detectsurffeatures(i2); [features1, valid_points1] = extractfeatures(i1, points1); [features2, valid_points2] = extractfeatures(i2, points2); indexpairs = matchfeatures(features1, features2); matchedpoints1 = valid_points1(indexpairs(:, 1), :); //error matchedpoints2 = valid_points2(indexpairs(:, 2), :); figure; showmatchedfeatures(i1, i2, matchedpoints1, matchedpoints2); i new matlab , trying understand concepts got stuck in this. appreciated. thank you. i tried code (with slight changes) sample image , worked: //open image = rgb2gray(imre...

C++ print palindromes from a text file -

check if string palindrome using link above try solve problem (among many others, ive been trying solve various ways day no dice, first c++). other examples in array format, , can't make assumptions length of word. i'm trying make program detect if word palindrome or not. have text file 1 word per line, , want test each word, line line, if palindrome, , if print screen, , if not, ignore , not print it. figured best way locate palindromes reverse word line line , match original, , if same (==), print it. here have far: #include <iostream> #include <vector> #include <string> #include <cctype> #include <fstream> using namespace std; int main(int argc, char *argv[]) { std::string line; std::ifstream infile("wordlist.txt"); } string reverse(string line){ if (line == string(line.rbegin(), line.rend())) { cout << string; } } all appreciated i guess question homework question , information...

Why Shake dependencies are explicitly `needed`? -

i find first example of shake usage demonstrating pattern seems error prone: contents <- readfilelines $ out -<.> "txt" need contents cmd "tar -cf" [out] contents why need need contents when readfilelines reads them , cmd references them? can avoid requiring applicativedo ? i think part of confusion may types/semantics of contents . file out -<.> "txt" contains list of filenames, contents list of filenames. when need contents requiring files created , depended upon, using filenames specify files. when pass contents on cmd passing filenames tar use query files. so key point readfilelines doesn't read files in question, reads filenames out of file. have use need make sure using files fine, , use files in cmd . way of looking @ 3 lines is: which files want operate on? make sure files ready. use files. does make sense? there's no relationship applicativedo - it's presence wouldn...

ios - What is the meaning of sending the "class" message to an instance of a class -

in facebook login code @ https://developers.facebook.com/docs/facebook-login/ios/advanced , ask execute following sequence declare view displayed of "fbsdkloginbutton" class through storyboard. execute following line in app delegate didfinishlaunchingwithoptions. [fbsdkloginbutton class]; what meaning of sending "class" message object? it used call initialize method of fbsdkloginbutton . +(void)initialize method called before instance of class initialised. called once. [fbsdkloginbutton class] used trigger initialize method called.

openerp - How to update one2many in customers from accounting invoice -

i have created one2many customer form. so, when validating (button validate) invoice trying pass values in one2many. have tried many ways , followed odoo forums, having trouble that. using following code: one2many field 'customer_status' in 'res.partner' : @api.multi @api.model def invoice_validate(self): customer_obj=self.env['res.partner'] customer_id=customer_obj.search([('id','=',self.partner_id.id)]) customer_line=customer_obj.browse(customer_id) dd = {'policy_number': self.policy_no,} customer_stat_add = customer_obj.write([customer_line.id],{ 'customer_status': [(0, 0, dd)] }) state_change = self.write({'state': 'open'}) return state_change, customer_stat_add it gives me error: valueerror: "invoice_validate() takes 2 arguments (1 given)" while evaluating u'invoice_validate()' thanks. buttons w/ new api need @api.multi , if want work on single object can use ...

css - horizontal touch scroll in android brwoser -

Image
i trying use -webkit-overflow-scrolling: touch; in web site notice not working fine in android when <html dir="rtl"> . if remove dir="rtl" works fine. is there way fix problem keep using -webkit-overflow-scrolling: touch; safari , chrome. bug android browser? works fine on chrome , safari here live demo: http://jsbin.com/azedel/2 here screenshots: before scrolling after scrolling (as can see there white space on left)

.net - Any Risk in Using Static Method in IDisposable? -

i have class implements idisposable , want make of methods static. doing have negative impact on memory management or else? there shouldn't risk in calling static method there. i'm curious, though, why want to. idisposable should dealing cleaning native resources used given instance. static methods don't work on specific instance of object (unless pass parameter). seems method call better instance method rather static one.

How to load a Custom PHP Magento Block inside a template file -

i've created custom block based on tutorial http://blog.magikcommerce.com/how-to-show-most-viewed-best-selling-products-in-magento-store i call block home.phtml template file. i call static blocks from: <?php $helper = mage::helper('cms'); $source = mage::getmodel('cms/block')->load('my-block'); $processor = $helper->getpagetemplateprocessor(); $html = $processor->filter($source->getcontent()); echo $html; ?> and works charm, of course! ' how can load dynamic blocks, in case, inside template files. my bestseller.phtml file is: app/design/frontend/default/default/template/catalog/product/bestseller.phtml and class is: mage_catalog_block_product_bestseller loading block template file bad style, possible. the dirty way template file echo $this->getlayout()->createblock('catalog/product_bestseller')->tohtml(); the clean way: go layout xml file add block anyother , refer with echo $th...

api - How can you extract news articles given keywords and news sources? -

i working on data mining project need automatically extract news articles particular keywords specific news agencies. solution writing news source specific crawlers (like scrapy/selenium) , extract articles doing keyword search on news source webpage or on google. but can see, solution not scalable. also, how extract new articles every-time new article related keywords appears. eg. taking care of duplicability. wondering if google news has api or there other api available achieving above task.

.net - Setting initial value in a Kendo UI Cascading Combobox with server filtering -

i need make cascading combobox server filtering i'm having trouble setting initial value. the dropdownlist on combobox depends looks this: @(html.kendo().dropdownlistfor(model => model.selectedcompany) .name("userdetailselectedcompany") .htmlattributes(new { style = "width:115px;" }) .bindto(model.companylist) .value(model.selectedcompany)) where: model.selectedcompany string name attribute set because need in combobox (i've read on kendo ui forums i'm not supposed specify it, don't know how cascading combobox without it) model.companylist list<string> an here's combobox: @(html.kendo().comboboxfor(model => model.selecteddealer) .name("userdetailselecteddealer") .datatextfield("name") .datavaluefield("id") .htmlattributes(new { style = "width:325px" }) .filter(filtertype.contains) .autobind(false) .enable(false) .minlength(3) ...

vb.net - Is there a way to access Document Setting by code to uncheck the adaptivity box? -

i using vb net , macros create file in autodesk inventor 2014, placing , constraining between 2 other objects in assembly file. part adaptive , set adaptive in assembly. problem lies. part file won't able become adaptive. have found because of "adaptively used in assembly" box. reason becomes checked when part created. there command in vb.net access document settings , uncheck "adaptively used in assembly" box before set adaptive in assembly? thank reading question, , hope hear suggestions. parts , assemblies placed in assembly can adaptive in 1 assembly. sounds part placing has been set adaptive in assembly other assembly trying make adaptive in (sorry if sounds confusing). if part referenced in assembly, , adaptive there, can't adaptive anywhere else. can change adaptivity if not case. need reference occurrence of part in assembly document: occurrenceofyourpart.adaptive = true;

windows - Java program doesn't work on vista 32 bits -

so have made program in java , tested on windows 7 64 bits, work pretty when tried run in windows vista 32 bits, of program methods doesn't work, exemple, simple piece of code this propriedades.store(new fileoutputstream("c:\\sms beta 1.0\\config.properties"), null); don't work on vista, program run , frames displayed saving files , connecting devices com ports computer doesn't work , can't figure out why... it's because protection of vista or there may methods can used 64 bits system? thank in advance help. the filenotfoundexception implies 1 of 2 things: the folder c:\sms beta 1.0 doesn't exist. the folder exist, program doesn't have permission write and/or file in it. change permissions of folder (right-click , click 'properties' -> 'security') allow read & write access user program runs as, or change owner of folder. or, run program different user account has necessary permissions. i suspect it...

sql - Using ISNULL and DATEDIFF of dates to days and sum the result in select -

i couple of iterations in query. need number of days result. have 2 types of dates (ae dates) , (ipdates). each of them has start date , end date (aestartdatetime,aeenddatetime) , (ipstartdate , ipenddate) i select there table , substract both pairs each 2 number of days result 2 values in days format, want sum them. main condition these column's can null select ((isnull(datediff(day , aestartdatetime , aeenddatetime)),0) + (isnull(datediff(day , ipstartdate , ipenddate)),0)) 'ipbeddays' details this not work. can help just parenthesis out of place: select isnull(datediff(day, aestartdatetime, aeenddatetime),0) + isnull(datediff(day, ipstartdate, ipenddate),0) 'ipbeddays' details the last parenthesis in chunk below came before third argument of isnull() (same other isnull() statement well): isnull(datediff(day, aestartdatetime, aeenddatetime))

python - Printing a rather specific matrix -

i have list consisting of 148 entries. each entry 4 digit number. print out result this: 1 14 27 40 2 15 28 41 3 16 29 42 4 17 30 43 5 18 31 44 6 19 32 45 7 20 33 46 8 21 34 47 9 22 35 48 10 23 36 49 11 24 37 50 12 25 38 51 13 26 39 52 53 54 55... , on i have code work first 13 rows , 4 columns: kort_identifier = [my_list_with_the_entries] print_val = 0 print_num_1 = 0 print_num_2 = 13 print_num_3 = 26 print_num_4 = 39 while (print_val <= 36): print kort_identifier[print_num_1], '%10s' % kort_identifier[print_num_2], '%10s' % kort_identifier[print_num_3], '%10s' % kort_identifier[print_num_4] print_val += 1 print_num_1 += 1 print_num_2 += 1 print_num_3 += 1 print_num_4 += 1 i feel awful solution , there has better , simpler way of doing this. have searched through here (searched printing tables , matrices) , tri...

css - 100% height relatively positioned footer -

i'm building 1 column responsive blog site. have fixed position header navigation, content section x amount of blog posts (as excerpts) , footer containing contact form. <div id="header">navigation & branding</div> <div id="content">blog content</div> <div id="footer">contact form</div> everything working required apart height of footer. make footer height match height of browser window, (apart fixed header) when scroll bottom of page footer visible , fills browser window entirely. how achieve css? you can setting #footer position:absolute; setting both width & height 100%.

AngularJS: Load view from Controller? -

i'd understand how load view controller ? example, hypothetical: myfile.html <p>{{foo}}</p> .controller("myctrl", function(){ $scope.html = loadfilehere("my foo", "myfile.html"); console.log($scope.html); }); i'd expect output: <p>my foo</p> is possible ? thanks! i guessing talking loading partials? wouldn't load view controller, although maybe could...i use routes load view. controller return scoped data partial view , load ng-view div or whatever. example... in app.js (or whatever call it) assuming myfile.html in same directory: angular. module('app', []). config(['$routeprovider', function($routeprovider) { $routeprovider. when('/myfile', { templateurl: 'myfile.html', controller: myctrl }). otherwise({ redirectto: '/' }); }]); then maybe in controllers.js file: function myctrl($scope) { $scope.foo = ...

segmentation fault - What is the simplest standard conform way to produce a Segfault in C? -

i think question says all. example covering standards c89 c11 helpful. though of one, guess undefined behaviour: #include <stdio.h> int main( int argc, char* argv[] ) { const char *s = null; printf( "%c\n", s[0] ); return 0; } edit: as votes requested clarification: wanted have program usual programming error (the simplest think of segfault), guaranteed (by standard) abort. bit different minimal segfault question, don't care insurance. a segmentation fault implementation defined behavior . standard not define how implementation should deal undefined behavior , in fact implementation optimize out undefined behavior , still compliant. clear, implementation defined behavior behavior not specified standard implementation should document. undefined behavior code non-portable or erroneous , behavior unpredictable , therefore can not relied on. if @ c99 draft standard §3.4.3 undefined behavior comes under terms, definitions , symbols se...

windows 8 - Tile notification doesn't work if image doesn't exist at specified uri -

at server side send tile notifications via uri: <?xml version='1.0' encoding='utf-8'?> <tile> <visual lang=""en-us""> <binding template=""tilewidesmallimageandtext02""> <image id=""1"" src=""{0}""/> <text id=""1"">{1}</text> <text id=""2"">{2}</text> </binding> </visual> </tile> {0} uri image e.g. ms-appdata:///local/folder/{id}.jpg problem server doesn't know if specific image exists or not , in case if not - tile notification won't work (tile won't updated) there solutions e.g. specify default image or default binding (without image). a tile notification shown if of image resources referenced present , valid. fallback different image not possible. isn't possible have tile notification ...

java - Why is an integer resetting to 100 when it should update to something different -

the wall of code below should change value of "lowestguess" , "highestguess" time loop runs through. ideally, it's meant lower highest guess 100 , raise lowest guess 1 program can't guess lower or higher number has guessed (reducing amount of loops takes complete program. however, each time runs "takestab" function, lowestguess , highest guess reset defaults, 1 , 100 respectively. no idea what's going on here seeing i'm not getting errors. is possible because methods here private, don't update variables outside of respective scopes? import java.util.scanner; public class aiguessing { public static void main(string[]args) { //declarations* scanner inputreader = new scanner(system.in); int number; int guess; int guesses = 0; int lowestguess = 1; int highestguess = 100; //code system.out.println("welcome!"); system.out.println(...

javascript - Can't add nice shading to highcharts -

i have 2 lines, a , b , try paint in different colors area between them: green a > b , red a < b . i've implemented shading area via arearange series type. can see work here: http://jsfiddle.net/ksnst/ the problem is: when data grouping occurs (i.e. single point in chart corresponds more 1 day in case), shading goes crazy. if narrow down chart interval range selector in bottom, shading perfect. when widen goes out of line bounds. i tried write own handler arearange.datagrouping.approximation didn't much. ideas? there similar question here solution won't work grouping. as sebastian bochan states in answer it's simpler if create areas on / under shading directly data -- don't think need work you're doing build shaded areas. however does't solve data grouping problem. i can close -- not quite perfect. @ first thought issue using same aggregate function on data sets, doesn't work goes wrong whenever aggregates on crossing p...

html - Sprites inside the child of an absolute positioned element disappear in IE7 -

i'm new @ bear me. have absolute positioned box inside relative container , inside box i've 2 other divs, 1 posts , 1 sprites. sprites disappear in ie7 along top (and top) border on "posts." looks like. <div id="wrapper"> <div id="content"> <div id="left"></div> <div id="right"> <div id="icon"> <a href="#" class="icon" id="email"></a> <a href="#" class="icon" id="twitter"></a> <a href="#" class="icon" id="rss"></a> </div><!--icon--> <div id="posts"> <div class="posts_border"></div> <!--a bunch of other stuff--> <div class="posts_border"></div> </div> </div><!--right--> </div><!--content...

css - Trouble with selectors -

i'm trying duplicate style of existing menu using css. the cms platform i'm using comes given styling navgation. added new menu underneath , trying make same original. added id "wpmenu" div contains navigation selectors don't select. created jsfiddle jsfiddle works! it's frustrating , i'm not sure turn. html , css here: http://jsfiddle.net/nrrkw/ the particular selector seems failing #wpmenu li a again, works in jsfiddle not on website here: advance.trashswag.com. i had expected see following css apply newly created ul nav within "wpmenu" div: #wpmenu li { display: block; position: relative; padding: 7px 12px; color: #fff; overflow: hidden; text-transform: uppercase; font-size: 120%; } but if inspect element on site, styling not applied elements. can point out i'm missing here? you don't seem have #wpmenu li a style have invalid rule token here: #w...

symfony bundle as git submodule -

i have 2 symfony2 projects bundles, theses project under git management. those 2 projects have 1 bundle in common, want make bundle submodule in order merge differences between project , project b. i'v read this: splitting directory submodule don't understand how works official git page ( http://git-scm.com/book/en/git-tools-submodules ) refer command : git submodule add so, how can merge 2 version of commombundle using submodules ? commit projecta or projectb allso commit change submodules ? everytime commit push shared project (lets call project s) project or project b (the 2 main roots projects project s inside) you'll able merge since there 2 heads or 2 branches. in order merge you'll have commit/push both projects github (or another) can merge ( https://help.github.com/articles/merging-branches ) or inside 1 of projects (by pulling changes). i hope understanded looking for.

c++ - Unexpected results in Qt run in Application Output Pane (not in terminal) -

i using qt creator 2.7.0 , compiling 5.0.2 mingw 32bit simple c++ main.cpp: #include <iostream> using namespace std; int main() { int i; (i=1; i<52; i++) { cout << << endl; } return 0; } on project configuration can check box "run in terminal", when windows command prompt shows , expected results of 1 through 51 being printed out 1 number per line on each run of program. however, if uncheck , instead run in "application output" window. results not appear deterministic. on 1 run output number 1, on run stopped @ 48, run stopped @ 38. each time reporting exited code 0. anyways, what's deal here this? here's .pro file: template = app config += console config -= app_bundle config -= qt sources += main.cpp

asp.net - "The report definition for report 'xxx' has not been specified." -

i'm trying out ssrs first time asp.net web form. i created local rdlc report , used reportviewer in "default" web form. under smart tag chose "choose report" , selected rdlc report. when pressed f5 run report following error displayed though did choose report smart tag. "the report definition report 'xxx' has not been specified." please let me know why not working expected. thanks. coding report: <asp:content runat="server" id="featuredcontent" contentplaceholderid="featuredcontent"> <section class="featured"> <div class="content-wrapper"> <hgroup class="title"> <h1><%: title %>.</h1> <h2>modify template jump-start asp.net application.</h2> </hgroup> <p> learn more asp.net, visit <a href="http://asp.net" title="asp.net web...

javascript - jquery toggle triggers display to none -

i have weird behavior. want trigger event on click on span tag, let's #span id. when run in console, test : $('#span').toggle(function(){ console.log('hi'); },function(){ console.log('hey'); }); the #span display set none. tried find code interfere didn't find any... this version of toggle removed in jquery 1.9, if using jquery >= 1.9 toggle display state one possible solution enable removed functionalities add migration plugin after jquery another write toggleclick plugin below 1 this answer $.fn.toggleclick = function(){ var methods = arguments, // store passed arguments future reference count = methods.length; // cache number of methods //use return maintain jquery chainability return this.each(function(i, item){ // each element bind var index = 0; // create local counter element $(item).click(function(){ // bind click handler element return methods[inde...

java - Is the a way to hide the menu from one of the ListGridfield? -

Image
am trying set icon field 1 of header in listgridfield. hence dont want filtering submenu appear field. there way ? as of doing task using individual attributes. still submenu appears. iconlgf.setcansort(false); iconlgf.setcanfreeze(false); iconlgf.setcanfilter(false); the column have selected icon shows type, hence dont want list grid menu appear did try per javadoc ?: setshowdefaultcontextmenu public void setshowdefaultcontextmenu(boolean showdefaultcontextmenu) when set false, field not show context menu in header. parameters: showdefaultcontextmenu - showdefaultcontextmenu default value true i don't know if it's want .....

c++ - How can I draw inside two separate 3D windows within the same application on Windows using OpenGL? -

i implementing plug-in inside 3rd party program in c++ on windows. the 3rd party program has window displays 3d graphics using opengl. need plug-in create window displays 3d graphics using opengl. do need create new opengl rendering context window or there way can "reuse" opengl rendering context used 3rd party program? i assumed had create new opengl rendering context , tried following: // create rendering context hglrc = wglcreatecontext (hdc); // make calling thread's current rendering context wglmakecurrent (hdc, hglrc); however last function failed. reading the documentation of wglmakecurrent notice a thread can have 1 current rendering context. process can have multiple rendering contexts means of multithreading. does mean window need run in separate thread 3rd party program? you didn't post error code generated wglmakecurrent(), won't guessing reason. it's not binding itself, however. sentence 'a thread can have ...

ios - Save a value to disk XCode -

i've got pretty simple task i'm trying accomplish in objective-c. i make call web site, , value web site through http call. want save value disk can retrieve later. what best method - text file, or in plist file? it's 1 value may updated. call web site made on-demand. consider using nsuserdefaults storing single values for storing: [[nsuserdefaults standarduserdefaults] setinteger:100 forkey:@"storagekey"]; for retrieving: nsinteger myvalue = [[nsuserdefaults standarduserdefaults] integerforkey:storagekey];

javascript - How to implement WebRTC recording to Node.js server -

i create easy video blogging solution utilizing webrtc technology enable recording of video/audio directly browser, similar youtube's my_webcam. server component should based on node.js. i found node.js libraries general webrtc connection managment ( webrtc.io , holla , easyrtc), seems don't enable recording of streams on server. what's best way implement server-side recording? there libraries , tutorials available? this guy has ton of interesting webrtc experiments, including audio/video recording: https://github.com/muaz-khan/ here's demo of recording: https://www.webrtc-experiment.com/rtcmulticonnection-v1.4-demos/recordrtc-and-rtcmulticonnection.html it collects audio , video streams on client , gives blob of audio , blob of video can upload/splice together. not hoping for, think, job done. hope helps.

sql server - History tables for many to many relationships -

i need track version history of several entities, able see state of properties @ given point in history, includes many many relationships. has support changesets. given following tables: entitya ------- id name revision changeid entityb ------- id name revision changeid entityatoentitybmapping ----------------------- entityaid entitybid changeid changetracking -------------- changeid date user description for entitya , entityb tables have history table exact same columns. data modified through object model, before change committed create new changetracking entry , add id entities being inserted or updated, plus incrementing revision. have insert/update trigger on entitya , entityb tables, , copy previous data history table. @ given point have history entity in history table. the problem comes many many mapping tables. same mapping table , have history table, need able "at revision 3, entitya had these values columns, , these relationships entityb". entitya histor...

Excel import to MySQL: Date inserted as 0000-00-00 -

i have used phpexcel library import excel file (.xlsx) , insert mysql. i'm facing 2 problems date field: 1- in excel sheet try change date format desired one. upon saving, cells show format need (yyyy/mm/dd) when double-click edit them again change how before (mm/dd/yyyy) . 2- when file imported mysql through phpexcel columns inserted correctly except date column inserts 0000-00-00 . format in excelsheet same in mysql enters zeros. please help! the value store in phpexcel excel serialized datetime value (a float, representing number of days since 1/1/1900 or 1/1/9004 depending on whether windows or mac calendar used). changing format changing way value displayed. you either need know in advance whether cell contains date, or test using phpexcel_shared_date::isdatetime() method, , convert appropriately. can either retrieve using getformattedvalue() return value formatted string; or use built-in conversion functions convert unix timestamp ( phpexcel_shared_da...

Sendback to already completed Task of processInstance in Activiti -

how can send task marked complete in process instance.i trying use activiti engine apis achieve not find directly. i expecting like processengine.gettaskservice().sendback(task.getid()); any on appreciated. by adding sequence flow every other step exclusive gateway , conditional expression sendback achievable.

xcode - LLDB Type Summary with properties (NSManagedObject) -

after viewing wwdc2013 lldb debug session, want add custom type formatter 1 nsmanagedobject subclasses. can typing in debugger type summary -add myclass --summary-string "${var._name}" this works on variables, not on methods, hence properties. i've tried using python script via valobj.getchildmemberwithname without success. how can display property on nsmanagedobject subclass on lldb ? more info: http://lldb.llvm.org/varformats.html long story short, realized ${var.foo} syntax works ivars. not methods. not properties (which methods, give or take syntactic sugar). i have been thinking syntax run expressions in string summary format. ${expr:[$var selector]} or ${expr:3+$var} lacking that, workaround go python, , use sbframe.evaluateexpression command. there examples of python formatters in lldb source code, , on website can use starting point.

matplotlib - Fitting Maxwell-Boltzman distribution in Python -

Image
is possible make fit maxwell-boltzmann data in matplotlib or similar module in python? scipy.stats has support maxwell distribution . import scipy.stats stats import matplotlib.pyplot plt import numpy np maxwell = stats.maxwell data = maxwell.rvs(loc=0, scale=5, size=10000) params = maxwell.fit(data, floc=0) print(params) # (0, 4.9808603062591041) plt.hist(data, bins=20, normed=true) x = np.linspace(0, 25, 100) plt.plot(x, maxwell.pdf(x, *params), lw=3) plt.show() the first parameter location or shift away zero. second parameter scaling parameter, denoted a on the wikipedia page . to generate random variates (random data) distribution, use rvs method: newdata = maxwell.rvs(*params, size=100)

asp.net - how to pass an 2D array from code behind to JavaScript with web method -

i use web method, can pass string code behind javascript function. in code behind have 2d array , don't know how pass it. 1- array in code behind same in javascript? 2- need convert , send or need make string , send? 3- possible send , read array directly without changes? what best , quickest way?

javascript - How can I view, calculate and show total price with this form? -

html: <div class="simplecart_shelfitem"> <img src="image/frod001.gif" alt="" /> <p class="item_name">fishing rod model 001</p> <span class="item_price">bnd $189.95</span><br/> qty: <input type="text" class="item_quantity" value="1" style="width:20px;"/><br/> <input type="button" onclick="calculatetext();" value="add cart" /> </div> i new coding , javascript. want button working without php, javascript modify html, change span this: <span class="item_price">bnd <label id="price">189.95</label></span><br/> and js: function calculatetext(){ var price=document.getelementbyid("price").innertext var quantity=document.getelementsbyclassname("item_quantity")[0].value var total=price*qua...

Passing PHP Variables to JavaScript Function -

this question has answer here: how pass variables , data php javascript? 17 answers i'm attempting pass php variables javascript function, updated elements in bootstrap modal. works fine when first 5 passed, when attempt pass 6th acts if javascript function fails run. what's odd difference between working , non-working versions addition of parameter. don't understand why adding parameter cause fail. appreciate help! working php: echo '<td><a data-toggle="modal" href="#mymodal" onclick="updatemodal('.$order_id.','.$order_placed.','.$order_payout.','.$order_due.','.$order_pages.')" class="btn btn-primary btn-lg">view</a></td>'; non-working php: echo '<td><a data-toggle="modal" href="#mymodal" onclick=...

apache - Yii DocumentRoot on shared hosting -

i have big problem shared hosting. have developed app folder structure: /documentroot /backend /www /common /frontend /www i have asked change domain's document root /frontend/www didn't support change. there way configure .htaccess , app work folder structure without changing documentroot? thanks you

asp.net - Show two columns with the same name in Gridview -

i have gridview uses join. 2 of columns, different tables, have same name: <asp:gridview id="viewthemetypeassociationsgridview" runat="server" autogeneratecolumns="false" backcolor="#deba84" bordercolor="#deba84" borderstyle="none" borderwidth="1px" datakeynames="pk_user" cellpadding="3" cellspacing="2" datasourceid="sqldatasource6" onrowdatabound="viewthemetypeassociationsgridview_onrowdatabound"> <columns> <asp:boundfield datafield="name" headertext="name" sortexpression="name" /> <asp:boundfield datafield="name" headertext="organization team" sortexpression="name" /> </columns> </asp:gridview> <asp:sqldatasource id="sqldatasource6" runat="server" connectionstring="<%$ connection...

java - Gradle: Can I compile code that depends on its own output? -

this strange question, it's not theoretical... i'd make gradle project uses buildsrc java project inside. java project defines classes used in build process. the nasty trick is, gradle project produces bunch of outputs, including modified classes belong java project of buildsrc itself. is there way express gradle? the solution have in mind right is: run whole build script twice in row. there way avoid that? example, generating modified code buildsrc , re-compiling buildsrc , generating additional outputs of main gradle project? okay, building on michael easter's awesome example, can have main-level build call gradlebuild on 1 of own tasks: task generatenewcode() << { println("tracer top build") // buildtool java class defined in `buildsrc` // ... , has cyclic dependency on own // output (eek -- that's i'm dealing with!) buildtool.generatenewcode(); } task generatedocs(type: gradlebuild) { buildfile='bu...

How can I call/execute an imageJ macro with R? -

i've written macro in imagej spits out data frame analyze in r. i'd love able have whole procedure work in r without having first run macro manually in imagej. macro prompts user input , output directories , it's thing. i'm thinking there must function in r allow me specify macro , input , output directories (i recode these variables in macro somehow take these arguments through r script?) i gather can use system() command , found tantalizing clue somewhere else on web: system("./javaapplicationstub directory file[i] -batch zmacro") but not sure how implement (my macro utilizes batch processing part unnecessary). here example run macro file "test.ijm" cl (in osx). wrap command in r (not tested). path macro file should full path, not relative path. /applications/imagej/imagej.app/contents/macos/javaapplicationstub -batchpath /tmp/test.ijm

asp.net - Modalpopupextender with usercontrol -

i using different user controls modalpopupextender (within page, repeater etc.) , took time figure tricks how 2 togeather. i have ended following problem when pass param user control usercontrol.paramid = 1; i able receive in user control, @ strange step of page cycle. when try protected void page_prerender(object sender, eventargs e) { throw new exception(paramid); } i null paramid!? but when <% throw new exception(paramid); %> from html, correct paramid value. i tryied store paramid viewstate, hiddefield, , doing same error. also, when use user control wihout mpe, in regular aspx page, works fine. what catch?

Binding an array of json results to html in angularjs -

i'm pretty new angularjs, , getting json result set i'd display. have following; service: var post = function(data) { angular.extend(this, data); } post.getall = function() { return $http.get('/api/posts').then(function(response) { var posts = []; for(var = 0; < response.data.length; i++) { posts.push(new post(response.data[i])); } return posts; }); }; controller method: $scope.posts = posts.getall(); html view: <ul ng-repeat="post in posts"> <li>{{ post.title }}</li> </ul> the problem while repeats correctly, cannot access members of each object. eg: post.title or post.text not display. however, if use {{ post }} displays json entire result. where going wrong here? edit: i've seen comment below if use post[0].title it correctly displays, correct way displaying array of json results? i'd prefer use correct method, vs 1 "just works...

kivy - How to put "if the function has been called this many times" in Python? -

so i'm designing hangman game using python , kivy , want add win/lose option. one of functions i've defined button_pressed hides button if it's been pressed want function man_is_hung() have says "if button has been pressed 6 times, show "game over"." would please me? def button_pressed(button): (letter, label) in currentword: if (letter.upper() == button.text): label.text=letter button.text=" " # hide letter indicate it's been tried def man_is_hung(): if button_pressed(button) use decorator : example: class count_calls(object): def __init__(self, func): self.count = 0 self.func = func def __call__(self, *args, **kwargs): # if self.count == 6 : self.count += 1 return self.func(*args, **kwargs) @count_calls def func(x, y): return x + y demo: >>> _ in range(4): func(0, 0) >>> func.count 4 >>> func(0, 0) ...

Pass parameters from C# into Jquery -

how pass parameter c# value part of instead of hard coding different values. <div class="property-container"> <input class="progress-value" type="hidden" value="17" /> <div class="property-title">test</div> <div class="property-progress"></div> </div> <div class="property-container"> <input class="progress-value" type="hidden" value="32" /> <div class="property-title">test 2</div> <div class="property-progress"></div> </div> <div class="property-container"> <input class="progress-value" type="hidden" value="24" /> <div class="property-title">test 3</div> <div class="property-progress...

stack overflow - What does StackOverflowError mean in Java? What is its fix? -

i'm encountering following error: exception in thread "main" java.lang.stackoverflowerror @ account.draw(account.java:47) this relevant section of code: public double draw(double c) { if (c > 0) { return c; } else if (c < 0 && c > accbalance) { accbalance=-c; return accbalance; } return draw(c); } how can fix this? in code, if c == 0 , or c <= accbalance , keep on recursing method same value of c . so, go infinite recursion, filling stack. for each method invocation, stack frame allocated stack. code end allocating complete stack memory. so, e.g, if call method first time c = 0 , how stack grows: draw(0) draw(0) draw(0) draw(0) .. on you keep on passing 0 argument, doesn't satisfy of base cases. as how solve this, don't have enough context find out should go in place of return draw(c); . shouldn't there. perhaps return draw(++c); ?? can guess. ...

c# - Why this application is taking so much of memory? -

Image
so problem is, created 1 app personal use fetch html pages sites , display in web browser after alteration. every thing working fine perturbed me memory taking. after querying 3-4 terms, memory usage reaches approximate 300-400 mb. some relevant code app is void sentencebox_navigated(object sender, webbrowsernavigatedeventargs e) { gc.collect(); } htmldocument hd; word w=new word(); private void button1_click(object sender, eventargs e) { button1.enabled = false; status.text = "processing english req.."; if (checkinhis(querytxt.text)) { sentencebox.allownavigation = true; richtextbox1.text = w.engdefinition; sentencebox.documenttext = w.engdefinition; status.text = "word found in history.done!"; button1.enabled = true; return; } if (w == null || w.engwordprop != querytxt.text) { ...