Posts

Showing posts from May, 2011

ruby on rails 3 - Heroku Deploy Images Reset -

i have rails app deployed heroku. has image uploads. after deployed heroku again, unable see old images uploaded. is heroku reset images folder when app re-deployed? please tell me reason behind it. background heroku uses 'ephemeral file system' , application architecture point of view should considered read-only - discarded dyno stopped or restarted (which, along other occasions, occurs after each push), , not shared between multiple dynos. this fine executing code from, application data stored in database independent of dynos. however, file uploads presents problem, , uploads should not stored directly in dyno filesystem. solution the simplest solution use amazon s3 file upload storage solution, and, if using gem paperclip , natively supported within gem. there great overview article in heroku dev center using s3 , heroku ( https://devcenter.heroku.com/articles/s3 ), leads article contributed thoughtbot (the developers of paperclip) on implemenation spe

php - Symfony2 Jobeet tutorial day 3 error invalid mapping -

when generate bundle entities code php app/console doctrine:generate:entities ensjobeetbundle i'm getting error [doctrine\common\persistence\mapping\mappingexception] invalid mapping file 'ens.jobeetbundle.entity.affiliate.orm.yml' class 'ens\jobeetbundle\entity\affiliate'. this affiliate.orm.yml file: ens\jobeetbundle\entity\affiliate: type: entity table: affiliate id: id: type: integer generator: { strategy: auto } fields: url: type: string length: 255 email: type: string length: 255 unique: true token: type: string length: 255 created_at: type: datetime onetomany: category_affiliates: targetentity: categoryaffiliate mappedby: affiliate lifecyclecallbacks: prepersist: [ setcreatedatvalue ] try opening file in text editor, , replacing " " " " globally. my colleague having exact same issue on same file, ,

web services - Communication between PHP and Perl CGI scripts -

i have 2 scripts carry out different tasks on server. 1 written in perl (.cgi) other in php. i trying send out request perl cgi script doing this: $ua = lwp::useragent->new; $ua->agent("$0/0.1 " . $ua->agent); $ua->timeout(30); $querystr = (xxxmaskedxxx); $request = http::request->new('get', $querystr); $response = $ua->request($request); if ($response->is_success) { $search = strpos($res->content, "not"); if($search==true) { return -1; } } i tried 2 ways send result php: this: httpresponse::setcache(true); httpresponse::setcontenttype('text/html'); if (!$result) httpresponse::setdata("<html>message not delivered</html>"); else httpresponse::setdata("<html>message delivered</html>"); httpresponse::send(); and this: echo "content-type: text/html\n\n"; if (!$result) echo 'message not delivered' . php_eol

doctrine2 - Doctrine 2 memory hogging -

i'm using doctrine 2 zf2 project, i'm getting weird problem server cpu , memory. , server crashes. i'm getting lot of sleep state querys , seem not cleaned. mysql> show processlist; +---------+--------------+-----------+------------------+----------------+------+--------------------+------------------------------------------------------------------------------------------------------+ | id | user | host | db | command | time | state | info | +---------+--------------+-----------+------------------+----------------+------+--------------------+------------------------------------------------------------------------------------------------------+ | 2832346 | leechprotect | localhost | leechprotect | sleep | 197 | | null | | 2832629 | db_user | localhost | db_exemple | sleep | 3 | | null | | 2832643 | db_user | localhost | db_exemple | sleep | 3 | | null | | 2832646 | db_user | localhost | db_exemple | sleep | 3 | | null | | 283266

html - positioning an absolute element in the center of it's relative parent element -

here code want child element @ bottom , center of it's parent it's in bottom alright cant center i've tried text-align:center ; for parent and margin:0 auto ; for child doesn't work <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <html><body> <div style='background-color: yellow; width: 70%; height: 100px; position: relative; text-align:center'> outer <div style='background-color: green; position: absolute; width: 80%; bottom: 0 ; margin-right:auto ; margin-left:auto ; padding:5px'> inner </div> </div> </body> </html> this might answer question: centering percent-based div use percentages margins. <div style='background-color: green; position: absolute; width: 80%; bottom: 0 ; margin-right:10%; margin-left:

java - Regarding same Runnable reference on Multiple Treads -

this question has answer here: initializing 2 threads same instance of runnable 4 answers passing single runnable object multiple thread constructors [duplicate] 2 answers when call start() on thread passing runnable object argument, can pass same runnable reference start multiple threads? public class mymain { public static void main(string[] args) { myrunnableimpl impl = new myrunnableimpl(); new thread(impl).start(); new thread(impl).start(); } } yes, can when runnable implemented accordingly. but have careful runnable implementation not contain mutable state . can control in own implementations, runnable contract not specify. // can used multiple threads class statelessrunnable { public void run() { dosomething();

c# - Is HttpResponse.Write a blocking function -

i'm working on asynchronous http handler , trying figure out if httpresponse.write function blocks until receives ack client. the msdn documentation doesn't say; however, know msdn documentation isapi writeclient() function (a similar mechanism) mentions synchronous version block while attempting send data client. i thought of 3 possible ways determine answer: have tell me non-blocking write low level tcp test client , set break point on acknowledgement ( possible?) use reflection inspect inner workings of httpresponse.write method ( possible?) its not blocking, can use buffer , send them together. try set httpresponse.buffer=false; direct write client. you can use httpresponse.flush(); force send have client. about httpresponse.buffer property on msdn and maybe intresting you: web app blocked while processing web app on sharing same session

c# - Move rows from table to table -

i try move rows expired 1 table this: mysqlconnection connect = new mysqlconnection(connectionstringmysql); mysqlcommand cmd = new mysqlcommand(); cmd.connection = connect; cmd.connection.open(); string commandline = @"insert history select clientid,userid,startdate, enddate,first,city,imgurl,phone,type,seen events startdate<now();"; cmd.commandtext = commandline; cmd.executenonquery(); cmd.connection.close(); the table same (in each table have id column primary key, auto increment) , when run exception: column count doesn't match value count @ row 1 any idea why crash? the reason why error because number of column on table doesn't match on number of values being inserted. usual when have auto-incrementing column on table inserting. in order fix problem, need specify column name values inserted. example, insert history (col1, col2,....) // << specify column names here select clientid,

javascript - jQuery Conflicts With Joomla YooTheme WidgetKit -

i developing joomla site customer locally @ moment. i have jquery conflict doing head in! i running template yootheme: http://www.yootheme.com/demo/themes/joomla/2013/infinite/ the top slideshow jquery controlled. run yoothemes "widgetkit". i have simple contact form validated using jquery (for email address etc). when ever put contact form onto site, top slideshow disappears. this jquery code: <script src="********/js/jquery.js" type="text/javascript"></script> <script type="text/javascript"> jquery(document).ready(function() { jquery.noconflict(); function isint(n) { return typeof n === 'number' && n % 1 == 0; } // form validation jquery(".darkbtn").click(function(e) { e.preventdefault(); var email_check = /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,6}$/i; var email = jquery("form.form_contact .email").val(); var zipcheck = /[a-z]{1,2}[0-9r][0-9a-z]? [0-9][abd-hjlnp-uw-z]{2}/i

Why sometimes Matlab saves figures with wrong colors? -

Image
why matlab saves figures wrong colors? this code: http://pastebin.com/v50b9tsc basically plotting use commands plot , scatter. for example, @ image. points colored, colored in matlab, once save .png image, points lose color. and original: thanks my guess background blending messing color of points. how drawing background? a quick way of not having worry color use different makers 2 point sets. edit: (also try saving jpg. if hypothesis correct background might weird points should have right color)

Java/ Efficient way to find all permutation of lists -

this question has answer here: cartesian product of arbitrary sets in java 9 answers generating possible permutations of list recursively 3 answers i have list of lists in java: {{1,2},{3,4,5},{6,7,8}} i try find permutations of list. meaning, in result list next: {{1,3,6},{1,3,7},{1,3,8},{1,4,6}....{2,5,8}} there reasonable way it? here list<list<integer> implementation. static public void main(string[] argv) { list<list<integer>> lst = new arraylist<list<integer>>(); lst.add(arrays.aslist(1, 2)); lst.add(arrays.aslist(3, 4, 5)); lst.add(arrays.aslist(6, 7, 8)); list<list<integer>> result = null; result = cartesian(lst); (list<integer> r : result) {

How to take specific data from table and store it in a cookie codeigniter php? -

i'm new codeigniter , php, few days only, need little help. i'm trying put data in cookie table can check redirect user after login. in table users there 2 columns named admin , company 1 or 0 if user or not, , wish insert information cookie. function conformation in user_controler is: function conformation(){ $this->load->model('user'); $q = $this->user->confr(); if($q){ $data = array( 'username' => $this->input->post('username'), 'admin' => $this->input->post($a = $this->user->getadmin), // 1/0 users column admin 'company' => $this->input->post($c = $this->user->getcomp), 'login' => true ); if( $a == 1 ){ //is admin redirect admin view $this->session->set_userdata($data); redirect('user_controler/useradm'); } if($c == 1)

c# - How to preprocess/convert data of a databinding? -

i creating datagrid going define (through user-input) x , y values of curve presented on same window. curve going defined path containing series of quadraticbeziercurve objects. however, while user input coordinates of points path go through , quadraticbeziercurve 's data contains information regarding endpoints , control point, not point go through (other in straight line). i've done math figure out how calculate control point defined 3 coordinates curve must go through, need create curve. is possible bind datagrid "buffer" dataset processesed (though code-behind) , result bound quadraticbeziercurve ? or need to, on user input, delete existing path , construct new one? by virtue of binding itemssource collection, each row of datagrid bound item in collection. assuming mvvm, each item view model. view model can have properties values user enters, , changes can cause recalculation in exposes control point. part of ui can bound same property, a

iphone - UITableViewCell behaving strange -

Image
i posted thread earlier strange behavior when resizing uitableview fit keyboard. want simulate same functionality when user sends sms , uitextfield enters first responder (resizing tableview , show keyboard). the funny thing works great point when add new row tableview (message). keyboard remains in right position uitoolbar moves bottom of screen startingposition is. i demonstrate scenario following pictures (this test-project): this first state , works great. up-button simulate uitextfield entering first responder, add-button add item tableview, , down-button simulate uitextfield resigning first responder. i first press up-button resulting in following state: and press add-button add item tableview resulting in following (correct) state: and great, however, when start adding subviews(buttons, labels, etc) uitableviewcell, hell breaks loose. it's hard illustrate uitoolbar moves bottom of screen picture next shows: it important mention have created uitablev

Create a Windows executable (.exe) from Batch and Vbscript -

it asked me create windows executable (.exe) scripts written in batch , vbscript. unluckily don't know tool use realize that. therefore let me ask questions torment spirit is possible make such build? if is, recommend me open tools that? to make exe bat+vbs, think have modify content of scripts alot/a little? thank in advance feedback bat2exe converts batch files including other files in folder executables http://www.bat2exe.net

angularjs - Non-Singleton Services in Angular -

angular states in documentation services singletons: angular services singletons counterintuitively, module.factory returns singleton instance. given there plenty of use-cases non-singleton services, best way implement factory method return instances of service, each time exampleservice dependency declared, satisfied different instance of exampleservice ? i don't think should ever have factory return new able function begins break down dependency injection , library behave awkwardly, third parties. in short, not sure there legitimate use cases non-singleton sevices. a better way accomplish same thing use factory api return collection of objects getter , setter methods attached them. here pseudo-code showing how using kind of service might work: .controller( 'mainctrl', function ( $scope, widgetservice ) { $scope.onsearchformsubmission = function () { widgetservice.findbyid( $scope.searchbyid ).then(function ( widget ) { // returned objec

R Text mining - how to change texts in R data frame column into several columns with bigram frequencies? -

in addition question r text mining - how change texts in r data frame column several columns word frequencies? wondering how can manage make columns bigrams frequencies instead of word frequencies. again, many in advance! this example data frame (thanks tyler rinker). person sex adult state code 1 sam m 0 computer fun. not fun. k1 2 greg m 0 no it's not, it's dumb. k2 3 teacher m 1 should do? k3 4 sam m 0 liar, stinks! k4 5 greg m 0 telling truth! k5 6 sally f 0 how can certain? k6 7 greg m 0 there no way. k7 8 sam m 0 distrust you. k8 9 sally f 0 talking about? k9 10 researcher f 1 shall move on? then. k10 11 greg m 0 i'm hungry.

css - Chrome Canary - no styles -

i've downloaded chrome's beta browser , css appears switched off . cannot see in settings or dev tools change it. ideas? in chrome have in settings section via gear icon, choose "css" tab > "disable styles"

c# - How to remove the speech event handler? -

please have @ following code speechrecognizer sr2 = new speechrecognizer(); ... sr2.speechrecognized += new eventhandler<speechrecognizedeventargs>(sr2_speechrecognized); ... void sr2_speechrecognized(object sender, speechrecognizedeventargs e){} in here first code shows initialization of speech recognizer, second code shows registering event handler , third code shows event handler. now, need remove event handler. how can this? please help.. just use sr2.speechrecognized -= new eventhandler<speechrecognizedeventargs>(sr2_speechrecognized); since remove method uses delegate.equals check equality, don't need store new eventhandler<speechrecognizedeventargs>(sr2_speechrecognized); anywhere, , can make call above remove handler.

coffeescript - dynamically adding members to coffee-script object -

so have object looks module.exports = class book extends events.eventemitter constructor: -> @books = a: new small_book('aaa') b: new small_book('bbb') c: new small_book('ccc') d: new small_book('ddd') update: (pair, callback) -> @books[pair].update_book() @emit 'update' however, doing this, pairs = a: 'aaa' b: 'bbb' c: 'ccc' d: 'ddd' module.exports = class book extends events.eventemitter constructor: -> each pair in pairs @books[pair] = new small_book(pairs[pair]) or going through list , adding many pairs in list. how can this? from fine manual : comprehensions can used iterate on keys , values in object. use of signal comprehension on properties of object instead of values in array. yearsold = max: 10, ida: 9, tim: 11 ages = child, ag

asp.net mvc 4 - How do I fix Azure Websites to stop confusing .Net Framework 4.5 with 4? -

i using visual studio 2012 publish simple asp.net mvc 4 project using continuous publishing in tfs online , getting error: 1 error(s), 0 warning(s) exception message: application pool trying use has 'managedruntimeversion' property set 'v4.0'. application requires 'v4.5'. learn more at: http://go.microsoft.com/fwlink/?linkid=221672#error_apppool_version_mismatch . (type deploymentdetailedexception) add project: <ignoredeploymanagedruntimeversion>true</ignoredeploymanagedruntimeversion>

sql - In SQLite how to insert a new column into s table with values of a column in another table? -

in sqlite have 2 tables, t1 , t2. have same number of records. can run following command create new column in t1 alter table t1 add column t2_col; suppose t2 has 1 column. how replace t2_col's content t2's row row (by rowid essentially). use subquery read value corresponding t2 record: update t1 set t2_col = (select t2_col t2 t2.rowid = t1.rowid)

java - Adding an object into a static collection for a static method -

probably stupid question, has been driving me nuts days. first of all, i'm speaking code embedded in larger application class , method signature imposed. so goal create collection of gc information , code following : public final class jvmmemstats_svc { public static final void jvmmemstats(idata pipeline) throws serviceexception { list<garbagecollectormxbean> gcmbeans = managementfactory.getgarbagecollectormxbeans(); (garbagecollectormxbean gcbean : gcmbeans){ // loop against gcs gc gc = gcs.get(gcbean.getname()); if( gc != null ){ // gc exists } else { // new gc gcs.put( gcbean.getname(), new gc( gcbean.getcollectioncount(), gcbean.getcollectiontime()) ); } } public class gc { public long cnt, duration; public gc(long cnt, long duration){ this.set(cnt, duration); } public void se

c# - Correcting implementation of a Factory Method with parameters -

i'm making solution program builds robots different types of parts(c#). in case have 2 types share attributes , both types of part inherit abstract class part. until calling new actual button code in interface window , this. if (type == acuatic) part piecea = new acuaticpart(type,name,price,maxdepth); else part pieceb = new terrestrialpart(type,name,price,terrain,maxtemp); i know totally wrong design , should implementing factory method. thing don't know if it's ok send parameters factory this: in interface window: part piece = _partfactory.createpart(type,name,price,maxdepth,terrain,maxtemp); in concrete factory: public class concretepartfactory : partfactory { public override part createpart(type,name,price,maxdepth,terrain,maxtemp) { part mypart = default(part); switch (type) { case "actuatic": mypart = new aquaticpart(type,name,price,maxdepth); break;

PHP resize image proportionally with max width or weight -

there php script resize image proportionally max widht or height?? ex: upload image , original size w:500 h:1000. but, want resize thats max height width , height 500... script resize image w: 250 h: 500 all need aspect ratio. along these lines: $fn = $_files['image']['tmp_name']; $size = getimagesize($fn); $ratio = $size[0]/$size[1]; // width/height if( $ratio > 1) { $width = 500; $height = 500/$ratio; } else { $width = 500*$ratio; $height = 500; } $src = imagecreatefromstring(file_get_contents($fn)); $dst = imagecreatetruecolor($width,$height); imagecopyresampled($dst,$src,0,0,0,0,$width,$height,$size[0],$size[1]); imagedestroy($src); imagepng($dst,$target_filename_here); // adjust format needed imagedestroy($dst); you'll need add error checking, should started.

ios - Optimize UIBezierPath drawing -

i have problem hoping in community may have expertise in. working on drawing app. it's far , why, @ each touchesmoved:withevent, process of re-calculating approximate bezier curve must take place , redrawn. approximation algorithm such that, @ given moment cubic curve can become quadratic , back. therefore, bounding box of entire curve can change rather drastically point point. naive approach take bounds of bezier curve , pass setneedsdisplayinrect:, that's much, better calling setneedsdisplay, when profile code, of course, huge amount of time spent inside drawrect. comes problem, hoping reduce that. now, if stroke call inside of uibezierpath has sufficient overhead, render moot minimizing volume of rectangle needs re-drawn. case, , using naive approach becomes best alternative. that's possibility #1. hoping try, however, create algorithm minimizes aggregate volume of set of rectangles cover bezier path. in other words, instead of calling setneedsdisplayinre

hibernate - CDI + JPA Multiple @OneToMany - LAZY/EAGER - LazyInitializationException OR Cannot instantiate multiple bags -

i developing application using jboss 7, cdi, jpa, , other resources bundled. my question is: when create project in eclipse using maven-jboss-webapp-archetype generates files, have been extensively studying , trying along with. problem see myself little bit confused whether using hibernate resources or jpa resources. second question: when use multiple @onetomany relationships in same entity notice 2 behaviors: a) without specifying eager type fetch, deploys application when try use list gives me lazyinitializationexception error vastly discussed here. b) when specify eager fetchtype on @*tomany relationship doesnt deploys application. gives me error: cannot instantiate multiple bags. here problematic piece of code: @onetomany(cascade = cascadetype.all, mappedby = "teamuser" , fetch = fetchtype.eager) private collection<users> userscollection; @onetomany(cascade = cascadetype.all, mappedby = "teamranking" , fetch = fetchtype.lazy) private coll

events - Lower Keyboard sensitivity in java keyhandler? -

private class keyhandler implements keyeventdispatcher{ @override public boolean dispatchkeyevent(keyevent e) { if(e.getkeycode() == keyevent.vk_right){ tetrominolist.get(currentpiece).moveright(); }else if(e.getkeycode() == keyevent.vk_left){ tetrominolist.get(currentpiece).moveleft(); }else if (e.getkeycode() == keyevent.vk_up){ system.out.print("k"); tetrominolist.get(currentpiece).rotate(); } return false; } this code returns "kk" when press arrow once. how can configure java or computer register 1 key hit instead of two? edit: temporary solution private class keyhandler implements keyeventdispatcher{ int counter = 0; public boolean dispatchkeyevent(keyevent e) { if(e.getkeycode() == keyevent.vk_right){ tetrominolist.get(currentpiece).moveright(); }else if(e.getkeycode() == keyevent.vk_left){ tetrominolist.get(currentpiece).movele

Timer to count down in VB.Net 2010? -

i'm trying use timer count down specified time choose time being separated minutes , seconds using format mm:ss , stop when time reaches 00:00 . so far i've used previous answer found on here , modified best of knowledge counting down although i've hit snag in when timer starts counting down, it's delayed , out of sync when counting down minutes. for example, counting down 120 seconds; 02:00 > 02:59 > 02:58 > 02:57 > 02:56 > 02:55 and when continuing count down past 90 seconds under same test; 02:30 > 01:29 > 01:28 > 01:27 > 01:26 > 01:25 when countdown reaches 00 or 30 seconds, incorrectly displays minutes left , can't understand or figure out how fix it. here code counting timer; private sub tmrcountdown_tick(byval sender system.object, _ byval e system.eventargs) _ handles tmrcountdown.tick settime = settime - 1 lbltime.text = formattime

actionscript 3 - Always on top Adobe Air -

i know nativewindow.alwaysinfront property , use it, if application creates window set topmost well, overlay air app. example, teamviewer message windows. is there way achieve absolute topmost-ness ? no. but setting alwaysinfront false, , true again, put app on top again.

c++ - How to use base member initialization on an array? -

making blackjack game , need know how initialize array using base member initialization (i.e. intializing within constructor using unary scope resolution operator). //constructor card::card() :mrank(static_cast<rank>(ace)), msuit(static_cast<suit>(spades)), mranktext(), msuittext() { } i want initialize ragged arrays mranktext , msuittext const char * ranktext[number_of_ranks] = {"ace", "deuce", "trey", "four", "five", "six", "seven", "eight", "nine", "ten",

profiler - No 'Profile Test' context menu in Visual Studio 2012 Professional? -

i have installed visual studio 2012 professional, update 2, , update 3. in unit test explorer, still not see 'profile test' kind of context menu when right clicking on test. (saw number of posts saying wasn't there, install available updates) any suggestions? profiling unit tests feature upgraded professional express version get. i have 2012 express on machine if might problem..? thanks in advance!

javascript - update video source when clicking on a link -

i trying have page embedded video dynamically change source when link below video frame clicked. source videos on host server. i.e. pic illustrates it: sample of page http://imageshack.us/a/img829/7679/testvidresult.png i came across this page , seems have answer, tried , didn't work. following example, pasted css & javascript in , necessary html in body. updated references urls , tried keep file names same example testing. below tried. can point out errors, or provide more elegant way of doing this? dynamically change embedded video when link clicked , video work in typical browsers, , devices. wordpress site, using jw player wordpress , (my error) instead found script/code video.js it loads pre image doesn't play. as test tried , play single video properly: <video id="testvideo" class="video-js vjs-default-skin" width="440" height="300" controls="controls"> <source src="

What's the best way to add an item to a C# array? -

i have following array: int[] numbers; is there way add number array? didn't find extension method concats 2 arrays, wanted like: numbers = numbers.concat(new[] { valuetoadd }); to concatenate 2 ararys at: how concatenate 2 arrays in c#? the best solution can suggest use list<int> numbers and when needed call toarray() extension method (and not opposite).

javascript - Handle an express redirect from Angular POST -

i'm using expressjs api , i'm using angular hit post. respond redirect express sending. success angular post returns html of page intend redirect nothing happens on dom. can see redirect working in network traffic, , console.log data, below contains dom of redirected page. how can refresh dom, reflect successful post, or handle "redirect"? angular code: $http({method: 'post', url: '/login', data:formdata}). success(function(data, status, headers, config) { console.log(data) }). error(function(data, status, headers, config) { }); $scope.username = ''; expressjs api: app.post('/login', function(req, res){ var name = req.param('name', null); // second parameter default var password = req.param('password', "changeme") // lots authenticationcode // returns succesfful login res.redirect('http://localhost:3000/'); }); // end app

mysql - How to sum up these grouped rows that also have an order by -

imagine data in table: amount/ number /type 100/ 1.2 / 120 / 1.2 /a 130/ 1.1 / 90 / 0.3 / 50/ 2.4 / b 150 / 1.9 /b 150 / 1.9 / b i want data in 2 groups 1 type a, 1 type b. within these 2 groups want them ordered price, ascending 1 , descending other. can do: (select * `table` `type`='a' group `number` limit 10) union (select * `table` `type`='b' group `number` limit 15) order `type`), (case when `type`='a' `number` end) asc, (case when `type`='b' `number` end) desc"; however problem want add types of same number.. 1.2 220/1.2/a, instead query 100/1.2/a... how add numbers amounts of same amount , same type? thanks this query want: (select sum(amount) amount, number, type `table` `type`='a' group `number` limit 10 ) union (select sum(amount) amount, number, type `table` `type`='b' group `number` limit 15 ) order `type`, (case when `type`='a' `number` end) asc, (case when

c++ - Modifying functor variable when using incremental spatial searching with cgal -

i've modified example given computational geometry cgal library ( link ) demonstrates incremental searching on 2d plane (section 49.3.2). example uses functor set spatial bounds searching positive points on plane. i modify functor k can passed in, demonstrated struct x_not_positive_k . complete example program below below shows modified code , original code. #include <cgal/simple_cartesian.h> #include <cgal/orthogonal_incremental_neighbor_search.h> #include <cgal/search_traits_2.h> typedef cgal::simple_cartesian<double> k; typedef k::point_2 point_d; typedef cgal::search_traits_2<k> treetraits; typedef cgal::orthogonal_incremental_neighbor_search<treetraits> nn_incremental_search; typedef nn_incremental_search::iterator nn_iterator; typedef nn_incremental_search::tree tree; int main() { tree tree; tree.insert(point_d(0,0)); tree.insert(point_d(1,1)); tree.insert(point_d(0,1)); tree.insert(point_d(10,110)); t

windows - How to call shell commands by using absolute path with spaces inside? -

this question related to: why calling drush command system() fail? i need launch command like: c:\program files\iis express\appcmd.exe list site 1>nul 2>nul because of space command fails. i tried %20 in place of spaces, no luck. anyway solved issue by: replacing c:\users[administrator]\documents\iiexpress with c:\windows\system32\config\systemprofile\documents try: system("\"c:\program files\iis express\appcmd.exe\" list site 1>nul 2>nul"); you need put command quotes itself

php - JQuery popup.....Uncaught TypeError: Object [object Object] has no method 'dialog' -

i have been searching solution problem few days , have gained few grey hairs in process. echoing jquery popup script in php: echo '<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script src="functions.js"></script> <script type="text/javascript"> $(document).ready(function() { jqueryalert("insert message here!", 120); }); </script>'; the problem is, fires , doesn't. when doesn't fire outputs following error message in chromes js console: uncaught typeerror: object [object object] has no method 'dialog' from can discern similar questions( uncaught typeerror: object #<object> has no method 'dialog' ), problem dupl

Understanding simple pointers in C -

int main() { int *p1,*p2; int a; p1=(int *)malloc(sizeof(int)); p2=(int *)malloc(sizeof(int)); p1=&a; p2=p1; a=10; printf("\n%d\n",*p1); printf("\n%d\n",*p2); printf("\n%d\n",a); return 0; } when remove lines p1=(int *)malloc(sizeof(int)); , p2=(int *)malloc(sizeof(int)); output doesn't change. can please explain why? p1 = &a that throws away result of first malloc line, first malloc meaningless. p2 = p1 does same thing p2. the space pointers of p1 , p2 allocated on stack, can assign them want without additional memory. need malloc if want assign integer them doesn't have memory allocated somewhere else already. they both pointing memory allocated on stack a, , memory you've allocated on heap leaked , cannot recovered or released. can see true because when set 10, 3 print lines print 10. because of this, program correct without 2 malloc lines.

What is the difference between Intranet, ERP and CRM? -

i'm in internship , have been given project develop application warehouse. googled solutions found systems intranet , erp , crm . i don't know best solution , don't know difference between 3 solutions. what best 1 use application , best system use? p.s : can't use openerp system. intranets internal company websites used share information between colleagues or serve specific internal business needs, such internal ticketing systems support teams, etc. crm, or customer relationship management systems used storing , tracking information current , potential customers. integrated other systems, such sales systems, give single view of customer, i.e. show interaction customer may have made (telephone calls, meetings, previous sales etc). popular online crm used lot people @ moment salesforce.com, example. it sounds need erp system, or enterprise resource planning , integrate whole bunch of different systems , bring in things manufacturing, sales, custo

mysql - php replace database result with an image -

this first time have ever posted question. newbie, , hope formatting correct in message. love stack overflow. has helped me through many challenging situations. 1 has me stymied. i replace mysql database result image. have plant database i'm querying show lists of plants. results table consists of plant type, botanical name, common name, , whether native plant. the result native plant comes in database letter 'y' (for yes). replace 'y' image of oak leaf. code i'm using displays oak leaf on plants, not ones native plants. what do? feel need insert if statement in while loop, never works when try it. i've tried tons of different solutions few days now, , ask this. here's latest code i've got displays image every plant, not natives: while ($row = mysqli_fetch_array($r, mysqli_assoc)) { $native_image = $row['native']; $image = $native_image; $image = "images/oak_icon.png"; echo '<tr><td>&#

c# - How to inherits differents models in the same view in ASP MVC -

i developing asp .net mvc 3 application using c# , sql server 2005. i using entity framework , code first method. i have partial view 'gestion.ascx' contains form (textbox , listbox). this view use viewmodel 'flowviewmodel'. i want view use model 'gamme' have. i try put them both in 'inherits markup' but statements became underlined in red. infact, explain more question : i used flowviewmodel in partial view in order load data in list boxfrom differents models. now want store values selected , entred in local variables. i can't pass model 'gamme' controller because view 'gestion' not using model 'gamme'. this code of partial view 'gestion' : <%@ language="c#" inherits="system.web.mvc.viewusercontrol<mvcapplication2.models.flowviewmodel>" %> <% using (html.beginform("save", "anouar")) { %> <%: html.validationsummary(true) %>

html - difficulty applying a tumblr CSS -

i'm trying block posts home page , have code don't know how make work. any great! {block:indexpage} <p> printed on homepage </p> {/block:indexpage} {block:tagpage} {block:indexpage} <p> printed on page `tagged/xxx`</p> {block:text} <!-- add post type loops here --> {/block:text} {/block:indexpage} {/block:tagpage} you can't have {block:tagpage} , {block:indexpage} rendering @ same time. remove indexpage block tagpage block.

hyperlink - HTML do I need a mime type for the link tag? -

david crockford recommends ommitting type="application/javascript" attribute script tag. should same css link tag (omit "type=text/css" )? googled "html link omit mime type" , variants , didn't find anything per documentation <script> : the type attribute gives language of script or format of data. if attribute present, value must valid mime type. charset parameter must not specified. default, used if attribute absent, "text/javascript". now, let's take @ <link> : the default value type attribute, used if attribute absent, "text/css". the specification not clear on reason, contain this: since default type text/css... the type attribute purely advisory. modern browsers don't need if it's valid css.

python - I how can I return objects in Django? -

the following model.objects.all()[:10] will return 10 records ordered primary key. i'm trying objects in reverse order. in other words if highest primary key 5000, i'm trying 5000, 4999, 4998... i have tried: model.objects.reverse().all()[:10] but not appear affect order you can do: model.objects.order_by('-id')[:10]

php - Godaddy Ubuntu 3.6 mod_rewrite issues -

i have been @ 3 hours , cannot seem mod_rewrite work godaddy on shared server under subdomain. have app in subdirectory , i've used same rules before on multiple servers know work. here's i've got: php version 5.3.10-1 ubuntu3.6 subdomain root/ -.htaccess --appdir/ ---.htaccess ----public/ -----.htaccess subdomain root/.htaccess options -multiviews that's document root .htaccess , many have suggested godaddy servers. appdir/.htaccess options -multiviews rewriteengine on rewritebase /appdir rewriterule ^$ public/ [l] rewriterule (.*) public/$1 [l] this routes requests appdir/public directory appdir/public/.htaccess options -multiviews rewriteengine on rewritebase /appdir/public ### tried adding /appdir ### rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?url=$1 [pt,l] errordocument 404 index.php just sure mod_rewrite available, ran sudo a2enmod rewrite bash , checked aft

javascript - Is it possible to prompt user for input in any grunt task? -

i'm attempting use grunt make directory in project new posts blog. create directory inside of posts directory named yyyymmdddd-postnameinpascalcase . in order this, i'd have prompt user post name each time execute task. know grunt-init prompts users creating projects project templates, i'm curious if there's way inside gruntfile.js file established project. any thoughts? it's been while since question last asked, there project on github attempts questioner looking for. it's called grunt-prompt , here's url: https://github.com/dylang/grunt-prompt . it's way integrate prompts gruntfile. project readme like: grunt.initconfig({ prompt: { target: { options: { questions: [ { config: 'config.name', // arbitray name or config other grunt task type: '<question type>', // list, checkbox, confirm, input, password message: 'question ask user',

swing - How to add JTextField in time running in Java? -

in order develop edit text in java study. i'm problem: program once opened user, if user click in button "search", actionlistener add field in jpanel. for example: have class jtoolbar sets jtoolbar menu extends jpanel. then, add in jframe . within jtoolbar there's button "search", if user click @ button, jtextfield appears side menu instantly. i try create class private within jtoolbar class. so, add jtextfield jpanel contains jtoolbar . however, not working. there's no error. not appears jtextfield . solve problem ? when add component visible gui general code is: panel.add(...); panel.revalidate(); panel.repaint(); // needed you need revalidate() tell layout manager component has been added.

Unable to successfully dump emails retrieved from gmail to mbox file using python -

i have written below 2 code snippets. second 1 work's expected not first one.i unable find out why output list of print(msg_obj.keys()) @ line #22 in first snippet doesn't contain 'subject','from' keys while msg_obj contains header fields 'subject','from'. when dump emails mbox file using script , later open file using utility(mboxview.exe windows) ,utility doesn't recognise email dumped.please me out of this. suggestions welcomed. import imaplib,email,mailbox m=imaplib.imap4_ssl('imap.gmail.com',993) status,data=m.login('someone@gmail.com', 'password') m.select() #create new mbox file if doesn't exist mbox_file=mailbox.mbox('gmail_mails.mbox') mbox_file.lock() #get mails number status,data=m.search(none, 'all') try: mail_no in data[0].split(): status,msg=m.fetch(mail_no,'(rfc822)') msg_obj=email.message_from_string(str(msg[0][1])) #print debugging

UDP Service with amazon web services -

good day, i have been using aws quite bit cloud based system hardware project. using simpledb , notification service provided great. however, need backend on aws listens requests coming in, processes , sends particular address. kind of udp service. i write c#/c++ app it, not sure if can host on aws. know how works? short answer: yes. ec2 instances other virtual machine, can put in server listens udp. configuring network is, of course, more complicated, possible. 1 thing making more complicated udp not able enjoy load balancer service amazon offers, (currently) supports tcp-based protocols. so, if have 1 server wish put on internet, procedure same you'd tcp server: set server , elastic ip pointing it, , have clients connect (by knowing elastic ip you've been allocated, or referring ip via dns resolution). if have multiple servers wish set up, answering same address, life bit more complicated. tcp, have set amazon load balancer , assign elastic ip load bala

Javascript functions like "var foo = function bar() ..."? -

the code goes (the syntax may seem odd far know, there nothing wrong it. or there?) var add=function addnums(a, b) { return a+b; } alert("add: "+ add(2,3)); // produces 5 alert("addnums: "+addnums(2,3)); // should produce 5 addnums() declared function. so, when pass parameters it, should return result. then, why not getting second alert box? you seeing named function expression (nfe) . an anonymous function expression assign function without name variable 1 : var add = function () { console.log("i have no own name."); } a named function expression assign named function variable (surprise!): var add = function addnums() { console.log("my name addnums, know."); } the function's name available within function itself. enables use recursion without knowing "outside name" of function - without having set 1 in first place (think callback func

c++ - undefined reference to vtable after the creation of a class object -

this question has answer here: c++ undefined reference vtable , inheritance 3 answers i have following 2 classes: class grill { public: virtual ~grill(); virtual std::string get_model() const{return _model;}; virtual void set_price(float p){_price=p;}; virtual float get_price() const {return _price;}; virtual grill* clone()=0; protected: grill(std::string m,float p):_model(m),_price(p){}; grill(const grill& obj)=default; grill(grill&& obj)=default; std::string _model; float _price; private: grill& operator=(const grill& obj)=delete; }; class grill_charcoal final : public grill { public: grill_charcoal(std::string m,float p):grill(m,p){}; ~grill_charcoal(){}; grill_charcoal* clone() override{return new grill_charcoal(*this);}; protected: grill_charcoal(const grill_charcoal& obj)=default; grill_charcoal(gril