Posts

Showing posts from July, 2011

Python win32com Outlook HTMLbody formatting directory incorrectly -

i trying send hyperlink shared directory using win32com in body text of outlook email. not sure happening path when program ran making directory appear below. import win32com.client win32 outlook = win32.dispatch('outlook.application') mail = outlook.createitem(0) mail.to = 'email addresses' mail.subject = 'subject' mail.htmlbody = ("hello -<br><br>" "please find following files in shared drive:<br>" "<a href='\\servername1\apps\folder'>" "\\servername1\apps\folder</a><br><br>" "the file names are:<br>" "filenames") mail.send the file path appearing in email as: \servername1pps\folder guy @ work able answer question. import win32com.client win32 outlook = win32.dispatch('outlook.application') mail = outlook.createitem(0) mail.to = 'email addresses' mail.subject = 's...

Mahout Recommender - questions to setup user preference -

i'm looking advice / guidance -- i'm working on recommendation engine / personnel assistance app, using mahout framework - what want new users of app begin answering 5 questions , use answers questions effect recommendation -- pretty feeding answers user-preference i'm not sure how incorporate code, i'm not sure begin looking - i've been googling none of search results address this... any suggestions / advice / guidance appreciated thanks i did new spark itemsimilarity implementation year ago. you'll need search engine recommendations query because mahout doesn't have server. i'd suggest using new "universal recommender" engine template predicitonio. uses mahout calculate model , elasticsearch serve it. https://templates.prediction.io/predictionio/template-scala-parallel-universal-recommendation preditionio framework of integrated components provide event server (for event storage) integration hadoop/hdfs, spark, hbase,...

c++ - undefined reference 'OpenNIProcessor::run()' -

i have created header file 'openniprocessor.h' , have declared run() method in headerfile. the error-message is: main.cpp: undefined reference 'openniprocessor::run()' openniprocessor.h class openniprocessor { public: void cloud_cb_ (const pcl::pointcloud<pcl::pointxyzrgba>::constptr &cloud); void run(); protected: private: }; openniprocessor.cpp class openniprocessor { public: void cloud_cb_ (const pcl::pointcloud<pcl::pointxyzrgba>::constptr &cloud) { .... } void run () { .... } } main.cpp int main() { openniprocessor v; v.run(); return(0); } you have rewrite code in file openniprocessor.cpp follows: void openniprocessor::cloud_cb_ (const pcl::pointcloud<pcl::pointxyzrgba>::constptr &cloud) { .... } void openniprocessor::run () { .... }

java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET from linux terminal with twilio -

in small java program run centos terminal, getting java.lang.nosuchfielderror: def_content_charset error when type in java -cp .:"../dependencies/*" mainpackage.sendtext xxxxxxxxxx hellothere @ centos 7 terminal. how can resolve error program can run command line? the terminal input , output follows: [user@domain bin]$ java -cp .:"../dependencies/*" mainpackage.sendtext xxxxxxxxxx hellothere exception in thread "main" java.lang.nosuchfielderror: def_content_charset @ org.apache.http.impl.client.defaulthttpclient.setdefaulthttpparams(defaulthttpclient.java:175) @ org.apache.http.impl.client.defaulthttpclient.createhttpparams(defaulthttpclient.java:158) @ org.apache.http.impl.client.abstracthttpclient.getparams(abstracthttpclient.java:448) @ com.twilio.sdk.twiliorestclient.<init>(twiliorestclient.java:151) @ com.twilio.sdk.twiliorestclient.<init>(twiliorestclient.java:110) @ mainpackage.sendtext.main(sendtext.java:20) where xxxxxxxx...

c# - Sync migrations with actual changes -

ef migrations not automatically detect complex changes, created empty migration , made changes hand up() , down() . updated database, , worked in both forward , reverse directions. but later, when made more changes , created new migration, it automatically added kinds of changes not needed - handled them manually in previous migration . i know can delete migrations , start scratch, that'll create far many problems, don't want that. how fix this? you can establish new baseline if don't have prior released databases out there. delete old migrations run: add-migration mybaseline –ignorechanges update-database now model , database in sync , can make model changes , create new migrations. turn automigrations on until ready deploy roll them single migration can script out clients. https://msdn.microsoft.com/en-us/data/dn579398.aspx#step3

javascript - React component unmounted -

my react app routes so: <route handler={routehandler}> <route name="welcome" path="welcome" handler={welcomepage} /> <route name="app" path="/" handler={application}> <route name="some-page" path="some-page" handler={somepage} /> </route> </route> the main "app" layout following export default class application extends react.component { render() { return (<div> <modalview /> <topbar /> <routehandler /> </div>); } } the topbar giving me problems: export default class topbar extends react.component { componentdidmount() { userstore.addchangelistener(this._onchange); } componentwillunmount() { userstore.removechangelistener(this._onchange); } _onchange = () => { this.setstate(this.getstate()); }; handleloginc...

linux - Is there any difference between the three assignment ways: a=1, let a=1, ((a=1)) -

consider 3 ways assign value: #!/bin/bash a=1 let a=1 ((a=1)) are 3 assignments totally equal? if shell has non-posix extensions (ie. ksh or bash), they're entirely equivalent: a=1 string assignment, whereas let a=1 , (( a=1 )) numeric assignments, gets stored in a string representing number 1 in every case. $(( )) posix-compliant way create math context. (( )) , let , contrast, not specified posix, extensions available in shells go beyond standard. now, consider instead: b=2 # result | posix? | type | comments # --------+---------+--------------------+---------------- a=b # a=b | true | string assignment | let a=b # a=2 | false | numeric assignment | ancient non-posix syntax a=$((b)) # a=2 | true | numeric assignment | modern posix syntax ((a=b)) # a=2 | false | numeric assignment | modern non-posix extension

how to query ArcGIS online rest service -

Image
how query arcgis rest service return values based on sql statement... i can query object ids use statement when include statement error, ideally remove object id , query service. any appreciated you missing quotes in clause. should owner = 'parks'

c# - SharpDX Create surface from bitmap -

i looking way same final output directx code: surface = new surface(device, alphabitmap, pool.systemmemory); i have directx wrapper sharpdx or slimdx but doesn't seem have of useful surface commands @ loss how proceed. sharpdx , slimdx .net wrappers around native c++ directx interfaces. not based on , independent of directx 9.0 managed code on example code based. to learn how use sharpdx suggest clone samples repository at https://github.com/sharpdx/sharpdx-samples and study examples. target directx ver 11 , if need ensure code runs on directx 9 graphic cards state requirement via direct3d feature levels. see( https://msdn.microsoft.com/en-us/library/windows/desktop/ff476876(v=vs.85).aspx )

MongoDB : How to separate the log file by date? -

i'd separate log files date. instance, mongodb2015-08-23.log mongodb2015-08-24.log mongodb2015-08-25.log i cannot find way this. did miss options in config file? my mongodb config file below. systemlog: destination: file path: c:/mongodb/mongodb.log logappend: true how can fix it? one solution create cron job (scheduled task) rename mongodb.log mongodb2015-08-23.log in last seconds (if possible) right before date change 2015-08-24 , example. here brought specific date, need make generic.

How to remove merge request from GitLab server -

i created merge request on gitlab (local) server. whenever click on merge request, request times out error 500. before used error code 504 , applied change mentioned in this gitlab support topic . all want remove merge request. there manual way of doing this? yes, there is.... not find way remove merge request in user interface, can delete database. (please note, tested on gitlab ce 8.4.0-ce.0 on ubuntu 14.04.3 lts.. other versions may have different database structure) at command prompt, execute following command (as root): sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq_production this bring postgresql command terminal. next, you'll have find merge request you'd delete. type following @ postgresql command terminal: select id, title merge_requests; you'll list of merge request ids , titles. find 1 you'd delete , note id ok, let's you've found merge request you'd delete , id 5 . you...

Javascript to PHP else if ": ?" operator conversion -

i have never encountered in javascript far although aware : ? means else if. having trouble figuring out how lay out in php. here did - going wrong if wrong? jscript var midparams = dparams2.isramped() ? dparams2 : dailyparams.avg(dparams1, dparams2); php $midparams = $dparams2->isramped() if $dparams2 = $midparams else $dailyparams->avg($dparams1, $dparams2); you've got 2 options. 1st 1 same javascript $midparams = ($dparams2 -> isramped()) ? $dparams2 : $dailyparams->avg($dparams1, $dparams2); the second 1 more trivial: if ($dparams2 -> isramped()) { $midparams = $dparams2; } else { $midparams = $dailyparams->avg($dparams1, $dparams2); } first 1 says: midparams dparams if statement before true, or $dailyparams->avg($dparams1, $dparams2) if not. second same thing in more straight forward fashion.

java - Moving undecorated stage Javafx with JXML and Scene Builder -

i'm trying capture x , y coordinates of undecorated pane in javafx. project created using javafx, jxml , scene builder. there other links on hints answer, i'm quite not able implement it. either build error exception or nan coordinates. minimum modifications required implement movable panes functionality following code? here code mainapp.java (skipping imports handled netbeans well) public class mainapp extends application { @override public void start(stage stage) throws exception { gridpane mainpane = fxmlloader.load(getclass().getresource("/fxml/scene.fxml")); scene scene = new scene(mainpane, color.transparent); scene.getstylesheets().add("/styles/styles.css"); stage.initstyle(stagestyle.transparent); stage.setscene(scene); stage.show(); } public static void main(string[] args) { launch(args); } } fxmlcontroller.java public class fxmlcontroller extends gridpane { public void rootnodeclick(mouseevent mouseeve...

windows - Git Bash 2.5 cannot connect to mysql -

i'm having annoying problem connect mysql git bash 2.5 (via windows on localhost). works fine trough cmd , mysysgit. $ mysql -u root -proot warning: using password on command line interface can insecure. welcome mysql monitor. commands end ; or \g. mysql connection id 7 server version: 5.6.26-log mysql community server (gpl) copyright (c) 2000, 2015, oracle and/or affiliates. rights reserved. oracle registered trademark of oracle corporation and/or affiliates. other names may trademarks of respective owners. type 'help;' or '\h' help. type '\c' clear current input statement. mysql> but, @ this. git scm windows still stuck, blinking cursor ever , ever. have guys seen this? can me? $ mysql -u root -proot warning: using password on command line interface can insecure. thanks in advance. the solution provided here: git bash mysql blank use winpty before window command , works. winpty mysql -u root -proot

automapper - Windsor Castle Equivalent of Autofac's IStartable -

i'd able implement in windsor castle container set up: "for types implement istartable in current assembly register them , run start method them." similar can using autofac things registering automapper mappings. eg public class myblahviewmodelmapper : istartable { public void start() { mapper.createmap<myblahentity, myblahviewmodel>(); } } autofac automagically.... i'm thinking windsor can't me here? windsor has own istartable interface. if want windsor register objects , create/run them after you'd use startable facility that. to clarify, there 2 concepts here: istartable interface, provides start , stop methods. lifecycle interfaces provide lifecycle callbacks: start being called right after component instance gets created (after constructor runs) startable facility, forces istartable components instantiated , started after installers have ran. here's code like: container.addfacility...

angularjs - How to get the specific data in a response inside controller? -

i have code of login. getting data response hosting okay , ng-repeat in view once it's validate shows data. want make validation it, want specific data ex:username in data compare user input. when try specific entity username or password in controller, undefined variable shows alert figure selected. how able that? can me solve this. $scope.login = function (user) { userfactory.login($scope.users).then(function (response) { console.log("student profile" + angular.tojson(response)); $scope.user = response.data; alert($scope.user.username); alert($scope.user.password); }, function (err) { var alertpopup = $ionicpopup.alert({ title: 'login failed!', template: 'please check credentials!' }); }); }; <button class="button button-block button-balanced" ng-click="login(user)">login</button> <div class="list card"...

java - Cannot write chinese characters to a filename -

Image
public static void main(string[] args) throws ioexception { scanner in = new scanner(system.in); string filename = in.nextline(); writer out = new bufferedwriter(new outputstreamwriter( new fileoutputstream("c:/temp/"+filename+".txt"), "utf-8"));//ex thrown out.close(); } i'm trying create writer can handle chinese characters file name. can create file called 你好.txt example. however filenotfoundexception above code, works fine english characters not chinese characters. i followed answers here: how write utf-8 file java? produce above code doesn't work. anyone know how can accomplish this? stack trace: exception in thread "main" java.io.filenotfoundexception: c:\temp\??.txt (the filename, directory name, or volume label syntax incorrect) @ java.io.fileoutputstream.open0(native method) @ java.io.fileoutputstream.open(unknown source) @ java.io.fileoutputstream.<init>(unknown ...

javascript - How to make materialize Dropdown work in React? -

how make materialize dropdown work in react? <a classname='dropdown-button btn' href='#' data-activates='dropdown1'>drop me!</a> <ul id='dropdown1' classname='dropdown-content'> <li><a href="#!">one</a></li> <li><a href="#!">two</a></li> <li classname="divider"></li> <li><a href="#!">three</a></li> </ul> materialize dropdown documentation i've included materialize.js that's taken care of. i'm guessing it's data-activates attribute. i'm not getting error, there other way declare attribute make work in react? try dataactivates. <a classname='dropdown-button btn' href='#' dataactivates='dropdown1'>drop me!</a> ok, found @ react.docs; react supports data-* , aria-* attributes every attribut...

php - set value yiibooster datePickerGroup -

my code: <?php echo $form->datepickergroup( $model, 'to_date', array( 'widgetoptions' => array( 'options' => array( 'language' => 'en', 'format' => 'yyyy-mm-dd', ), ), 'wrapperhtmloptions' => array( 'class' => 'col-sm-5', ), 'hint' => 'click inside! super cool date field.', 'prepend' => '<i class="glyphicon glyphicon-calendar"></i>' ) ); ?> my to_date timestamp want befor view value convert value by: date("y-m-d",$model->to_date) accessor methods in model can serve well. if yii1 see accessor methods in model class, call accessors inste...

email - Remove mailed by in PHP mail using PHPMailer -

Image
i using phpmailer send mail in php program. email working fine showing mailed address in area.how can hide these mailed in phpmailer.and via details email area. when use php mail() function below removing mailed details.but how can in phpmailer mail('info@example.com', 'subj', "message", $headers, '-freturn@yourdomain.com') here php mailer code <?php require_once 'phpmailer/class.phpmailer.php'; $mail = new phpmailer(true); //defaults using php "mail()"; true param means throw exceptions on errors, need catch $body = "heloooo"; try { $mail->addreplyto('name@yourdomain.com', 'first last'); $mail->addaddress('to@example.com', 'john doe'); $mail->setfrom('info@example.ae', 'info'); $mail->addreplyto('name@yourdomain.com', 'first last'); $mail->subject = 'phpmailer test subject via mail(), advanced'; $mail->altbod...

javascript - Troubles with JS and jQuery -

before start, i'm going point out very, very new js , jquery, if seems simple fix stupid problem, expected. i have problem want solve using js , jquery script used insert content page. here's part browser getting caught on in console/debugger thing: if(fname != "" && fname != null) { var newrow = 'a long string contents irrelevant here.' $( ".all-waiting" ).append( newrow ); } the part it's getting hung on $ in jquery statement supposed used add contents of string specific page element. copied format of jquery statement tutorial online , verified against version had copied different project , managed have work successfully. doing wrong here? should doing append string newrow .all-waiting ? if makes difference, i'm introducing script via external js page imported html page of own creation. thanks help! edit: here's full relevant section of js code: /* ~~~~ get's variables url ~~~~ */ // sy...

javascript - document.GetElementById("main").innerHTML = "testing" is reverting, not changing permanently -

below java.html code inserting <a href='' onclick='load_des()'><li><p>$row[title]</p></li></a> element in div element id "main" echoing php script ajax response can see in below code. insertion successful, when click element load_des() function called, showing "testing" word blink , again showing link. intention show "testing" word permanently, don't know happening in ajax code? click link, click java option under domains, find link named test, link explaining above <!doctype html> <html> <head> <title></title> <script type="text/javascript"> function on_load(){ var xmlhttp; if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xm...

api - How to get shipping charge in DHL -

i cant able shipping charge in dhl. i know shipping charge when rated yes , service dutiable in plt service. but question without using dutiable or non-dutiable how can shipping charge. technically in request xml if put below tag , response without y shipping charge please guide me, thing change response xml or other tag not getting please me that.. <isdutiable>y</isdutiable> -- shipping charge <isdutiable>n</isdutiable> -- not shipping charge(required tag)

jquery - Validate a form to ensure atleast one radio button is checked in a group -

i making form radio buttons in it. able validate other input except radio button. got accepted solution in site using jquery check if no radio button in group has been checked but not working me http://jsfiddle.net/ghan_123/trr185l2/2/ my code <input type='radio' name='datetime' value='1'>1 <input type='radio' name='datetime' value='2'>2 <input type='radio' name='datetime' value='3'>3 <input type='radio' name='datetime' value='4'>4 <input type='radio' name='datetime' value='5'>5 <br><button id='buttonnew'>validate</button> jquery $(document).ready(function(){ $("#buttonnew").click(function(){ var selection=document.queryselector('input[name="datetime"]:checked').value; // method if(selection=='') { alert('please sel...

python - Recursively generate Compositions from an ordered list -

given ordered list of 'n' elements, want slice list generate every distinct permutation of sublists once only, whilst maintaining order of original list - i.e. generate every composition of input list. (this not same calculating every possible combination of possible sublists input list). for example, given input list [a,b,c,d] , output following 8 nested lists: [[a,b,c,d]], [[a,b,c],[d]], [[a,b],[c,d]], [[a,b],[c],[d]], [[a],[b,c],[d]], [[a],[b],[c,d]], [a,[b,c,d]], [[a],[b],[c],[d]]. drawing tree of possible permutations suggests problem lend recursive algorithm, i'm not sure how implement in python maximum speed , efficiency, , grateful advice , guidance. def composition(seq): seq = tuple(seq) in range(2**(len(seq)-1)): result = [[seq[0]]] j in range(len(seq)-1): if & (1<<j): result.append([seq[j+1]]) else: result[-1].append(seq[j+1]) yield result if __n...

How to fixed window size in eclipse rcp e4 -

Image
i didn't want dragged change size. i'm primary learner. create part in application.e4xmi. the structure 'window , dialogs ---> trimmed window ----> controls ----> part', created class associate it. if have 1 part in trimmed window can set style of window prevent resizing. you setting styleoverride value in 'persisted state' section on 'supplementary' tab of 'trimmed window' page in application.e4xmi. add persisted state value key of 'styleoverride' , value of '96' corresponds 'swt.close | swt.title' style.

c# - How to write a function that generates ID by taking missing items in a sequence? -

how can write algorithm can take unused id's out of sequence starting 1 99 in format "c00"? example newid(['c01', 'c02', 'c03']) should emit 'c04', newid(['c02', 'c03', 'c04']) should emit c01, , newid(['c01', 'c03', 'c04']) should result in c02. i wrote implementation result wrong. example : cat_id : c01, c02, c05, c06, c11. when run it, expected result c03. algorithm follows: sort id asc go through every item in list compare first value next, if not same, add 1 , exit loop. this code: public static string get_areaid_auto() { string result = ""; if (db.tests.tolist().count <= 0) { result = "01"; } else { int maxid = 0; foreach (var item in db.tests.orderby(e => e.cat_id).tolist()) { if (int.parse(item.cat_id.substring(1)) + 1 != int.parse(item.cat_id.substring(1))) ...

javascript - Undefined media issue -

i maintaine web site of friend of mine, , console logs following error: get https://www.my-client-site.ext/undefined 404 (not found) undefined:1 the problem can't find location of call in page. i have try search page source code, , cannot find referense url. also have try check js files break points, , still cannot find issue. is there other way make reseach particular issue ? go firefox , install addon called firebug. https://addons.mozilla.org/en-us/firefox/addon/firebug/ now open firebug , go console tab, firebug show javascript calling ajax in right corner of pane. hope helps.

java - Wrong splitting string (split(" ")) -

i have text, example: string text = "i have text". string[] s = text.split(" "); and have such result: s[0] - have, s[1] - some, s[2] - good, s[3] - text why splitter don't split text, when between space (" ") 2 or 1 symbols ("i have" , "a good"), , how solve problem? in java, split method takes regex parameter. such, i'd recommend splitting white space: text.split("\\s"); that way, if use different non-printable whitespace in text, split. see http://docs.oracle.com/javase/7/docs/api/java/util/regex/pattern.html

algorithm - Convert GPS data to latitude and longitude c# -

i have gps device(gt003) sends data server, need convert 01e0598a 0869058a values device sends latitude , longitude. latitude occupy 4 bytes, representing latitude value. number range 0 162000000, represents range form 0°to 90°. unit: 1/500 second conversion method: a) convert latitude (degrees, minutes) data gps module new form represents value in minutes; b multiply converted value 30000, , transform result hexadecimal number for example22°32.7658′,(22×60+32.7658)×30000=40582974, convert hexadecimal number 0x02 0x6b 0x3f 0x3e longitude occupy 4 bytes, representing longitude value of location data. number ranges 0 324000000, representing range form 0°to 180°.unit: 1/500 seconds, conversion method same latitude’s. expected output close 17°29'20.2"n 78°23'21.7"e 01e0598a(16) = 31480202(10). divide 30000 -> 31480202 / 30000 = 1049.34006666. mentioned, value in minutes. so: 1049.34006666/60 = 17.489001°(if need decimal of degrees - i...

android - Sqlite syntax error near "?" -

simple enough; code looks this: int idhash = getidhash(); string[] args = {"runways", ""+idhash}; cursor = sqlite.rawquery("select * ? idhash = ?", args); and see line in logcat: e/sqlitelog( 9570): (1) near "?": syntax error where did go wrong? you can use ? binding literals. cannot use binding identifiers such table names. identifiers must in sql itself.

Angularjs ui-router - pass extras 'unplanned' parameters -

i have simple state : .state('search', { url: '/search', templateurl: 'views/search.html', controller: 'search' }) and pass unplanned parameters controller when using search state or /search route : ui-sref="search({foo:1, bar:2})" // call '#/search?foo=1&bar2', // match state , pass foo , bar controller (through $stateparams) when try this, matches otherwise of router instead. :( i've read lot of solutions imply declare each parameter in state: .state('search', { url: '/search?param1&param2&param3?...', }) but cannot far parameters list not defined , changes time depending on searched content. is there way achieve ? or wrong somewhere ? thx. edit : when try call directly url : #/search?foo=1 , state search matches foo parameter never goes $stateparams empty. don't know how in. .state('search', { params: ['param1','param...

SQL Injection on Views -

we using 3-tier architecture in asp.net. there 3 layers presentation business data access the data access layer contains getdata , executequery etc function. want know that, want call view directly presentation layer. there chance of sql injection in calling view front-end without using stored procedure? presentation layer (c#) protected void btnview_click(object sender, eventargs e) { dl obj = new dl(); datatable tb = new datatable(); string query = "select * viewteacher fid = " + txtname.text; tb = obj.getdata(query); } dbaccess public datatable getdata(string query) { datatable datatable = new datatable(); sqlcommand cmd = new sqlcommand(); cmd.connection = con; cmd.commandtext = query; try { if (cmd.connection.state != connectionstate.open) { cmd.connecti...

objective c - Why are the view*Disappear methods not being called in iOS? -

i try when home button , power button has been clicked. developing in ios. this code use: - (void)viewdiddisappear:(bool)animated{ [super viewdiddisappear:animated]; nslog(@"viewdiddisappear"); } - (void)viewwilldisappear:(bool)animated{ [super viewwilldisappear:animated]; nslog(@"viewwilldisappear"); } - (void)applicationfinishedrestoringstate{ nslog(@"applicationfinishedrestoringstate"); } why above function not being called when click power button or home button on iphone? did miss something? viewdiddisappear: , viewwilldisappear: called if view pushed or popped or in anyway gets disappeared in own runloop, going background pressing home or power button doesn't count view' related events, rather app related events. should register uiapplicationwillresignactivenotification notification instead. e.g. [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(disappearselector) name:u...

ajax - Rails upload image and reposition like facebook -

i making app in want upload cover facebook , reposition it. can tell me how can make possible in rails? this demo link: http://demos.9lessons.info/ajaximageupload/index_bg_drag.php this great if can tell me how can same in rails. in advance. you can follow following tutorial image cropping , other stuff : https://railskumar.wordpress.com/2015/05/01/crop-zoom-and-rotate-image-using-carrierwave/ http://railscasts.com/episodes/182-cropping-images?view=asciicast pro : http://railscasts.com/episodes/182-cropping-images-revised?view=asciicast whichever tutorial follow submit form using :remote => true . can not submit image in simple form either need submit in iframe or through flash. solve problem use remotipart gem . same example image upload here .

c# - How to return my complex types from a wcf service, not model itself? -

i have separate layer complex types dataaccesslayer (dal), separate layer business businesslogiclayer (bl). create wcf service application project servicelayer (sl) , added service use bl methods , dal complex type return value. now,i have 1 problem in add refrence myservice in mvc project , : when added refrence of myservice, in refrence.cs generate complex type each mycomplex type used it. i want not generate complex type , use of complex type @ dal. dal using system.runtime.serialization; namespace dal { [datacontract] public partial class mycomplextype { //... [datamember] //my prop //... } } bl namespace bl { public partial class myrepository { public list<dal.mycomplextype> mymethod(int param1,int param2) { var parameters= new list<sqlparameter>(); parameters.add(new sqlparameter("param1",sqldbtype.int){ value = param1 }); par...

pdf - PDFBox - document is empty after loading -

i using apache pdfbox rendering thumbnails of pdf documents. therefore load pdf , use first page thumbnail. problem is, particular document, seems, not loaded correctly. other docs, works expected. bytearrayinputstream = new bytearrayinputstream(pdfdata); pddocument pdf = pddocument.load(is, true); list<pdpage> pages = pdf.getdocumentcatalog().getallpages(); //pages empty here the pdf file has 238 pages , around 6,5 mb of size. assuming you're using 1.8.* version, please use non sequential parser: pddocument pdf = pddocument.loadnonseq(is, null); the non sequential parser successful in cases old parser fails, e.g. pdfs have had revisions ( example ). advantage no code needed "protected" pdfs encrypted empty password.

ios - Behavior differences between performBlock: and performBlockAndWait:? -

i'm creating nsmanagedobjectcontext in private queue handle data updates take files and/or services: nsmanagedobjectcontext *privatecontext = [[nsmanagedobjectcontext alloc] initwithconcurrencytype:nsprivatequeueconcurrencytype]; appdelegate *appdelegate = [[uiapplication sharedapplication] delegate]; privatecontext.persistentstorecoordinator = appdelegate.persistentstorecoordinator; since i'm using private queue, don't understand difference between performblock: , performblockandwait: methods... perform data updates i'm doing this: [privatecontext performblock: ^{ // parse files and/or call services , parse // responses // save context [privatecontext save:nil]; dispatch_async(dispatch_get_main_queue(), ^{ // notify update user }); }]; in case, data updates made synchronoulsy , sequentially, suppose correct place save context, right? if i'm doing wrong, i'd appreciate if let me kn...

Builder Pattern vs Java Beans thread-safe -

based on example https://www.securecoding.cert.org/confluence/display/java/vna04-j.+ensure+that+calls+to+chained+methods+are+atomic what if change usage in first example thread safe version http://codeshare.io/zylut isn't same builder thread-safe point of view?

Compiling Objective-C in terminal on Mac OS -

i quite new both writing makefiles , objective-c language. trying compile small test application makefile: q = @ include_pref = -i cc := gcc #here source files specified list_src_files = $(shell find . -type f -name "*.m") srcs := $(subst ./,,$(call list_src_files)) #here our include files list_include_dirs = $(shell find . -type d -name "include") include_ls := $(call list_include_dirs) include_dirs := $(include_pref). include_dirs += $(addprefix $(include_pref), $(subst ./,,$(include_ls))) #flags used gcc cflags = -wall -fobjc-arc -framework foundation -g -o0 $(include_dirs) #here object files specified objs := $(srcs:%.m=%.o) #here name of target specified target := convertor #here our target $(target): $(objs) @echo "building target" $(q)$(cc) $(cflags) $^ -o $@ %.o: %.m @echo "building objects" $(q)$(cc) $(cflags) -c $< -o $@ .phony: clean clean: $(q)-rm $(objs) $(target) 2>...

Making changes to Chrome Devtools -

chrome devtools's has some undesirable behaviours regarding css sourcemaps in link https://code.google.com/p/chromium/issues/detail?id=257778 . is possible edit devtools's (like style panel) can things directing sourcemap links open them in editor or prevent loss of sourcemaps? able edit opera's dragonfly local source. possible make similar changes devtools? you can edit devtools ui , serve local source tree. see this doc more details.

Rake task identifying the environment as development ruby and sinatra -

i have written scheduler using "whenever gem". 1 of scheduler runs rake task everyday. rake task calls method in model , performs activerecord operations. everything works fine, activerecord connects "development" environment in database.yml file , connects development database while in production. config/schedule.rb set :output, "log/cron_log.log" every 6.hours rake "sidekiq:restart" end every :day, :at => '01:00am' rake 'prune_users:older_than_2months' end rakefile require 'newrelic_rpm' require './app.rb' import './lib/tasks/sidekiq.rake' import './lib/tasks/reap_user.rake' import './models/exportuser.rb' /lib/tasks/reap_user.rake require 'sinatra/activerecord' require 'sinatra/activerecord/rake' namespace :prune_users desc 'delete 2 months older users status non-active' task :older_than_2months exportuser.delete_users_b4_2month...

openfire - Strophe Ping Plugin Not responding -

i trying add strophe ping plugin in ping user , respond pong, , know user connected. but not sure how working. i read in documentation example, isnt working me. i want form of call saying other person connected. conn.addhandler(pinghandler, "urn:xmpp:ping", "iq", "get"); function pinghandler(ping) { var pingid = ping.getattribute("1"); var = ping.getattribute("from"); var = ping.getattribute("to"); var pong = $iq({type: "result", "to": from, id: pingid, "from": to}); conn.send(pong); return true; } i tried method below, method below send out ping , called success sent, there no respond in pinghandler. seems sent, not listened to/handled. conn.ping.addpinghandler( pinghandler ); function onping(){ var jid3="test4@macbook-pro.local" console.log("ping starts"); conn.ping.ping( jid3, success, error, timeout ); function succ...

html - Bootstrap modal: class="modal fade" causing problems -

i trying bootstrap modal tutorial work in view.ejs file. class="modal fade" seems causing problem. if remove class="modal fade" modal permanently shows up, if keep in code nothing happens when click on button. <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#mymodal">open modal</button> <!-- modal --> <div id="mymodal" role="dialog"> <div class="modal-dialog"> <!-- modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">modal header</h4> </div> <div class="modal-body"> <p>some te...

javascript - using POST to send js variable to php from iframe -

i trying pass variable js backoffice page. far i've tried using form , submitting javascript (but refreshes page, don't want) i ditched form , when iframe (so page doesn't reload everytime data submitted). function run every few seconds (so form should submitting): <iframe style="visibility:hidden;display:none" action="location.php" method="post" name="location" id="location"> <script> /*some other stuff*/ var possend = document.getelementbyid("location"); possend.value = pos; possend.form.submit(); </script> however php page not display value posted (im not quite sure how $_post variable): <?php $postion = $_post['location']; echo $_post['possend']; echo "this the"; echo $position; ?> i tried $.post suggested here using $.post send js variables didn't work either. how $_post variable valu...