Posts

Showing posts from June, 2010

java - ExpandableListView with different images for each groupHeader -

i'm gettin difficulties while setting different icons each groupheader while using expandablelistadapter, here's codes. at main, im calling @ oncreate() explistview = (expandablelistview) findviewbyid(r.id.lvexp); // preparing list data preparelistdata(); listadapter = new expandablelistadapter(this, listdataheader, listdatachild); // setting list adapter explistview.setadapter(listadapter); my adapter code: package info.androidhive.slidingmenu; import java.util.arraylist; import java.util.hashmap; import java.util.list; import android.content.context; import android.graphics.typeface; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseexpandablelistadapter; import android.widget.imageview; import android.widget.textview; public class expandablelistadapter extends baseexpandablelistadapter { private context _context; private list<string> _listdataheader; // header titles //

git - mapping branches/user/* properly in subgit -

i'm evaluating subgit, , looks imports well, except have both standard , nonstandard branches in our svn directory: - trunk - tags - branches - test - jira_89 - jira_92 - user - jim - bob there standard branches branches/test , branches/jira_89 , have few branches branches/user/jim , branches/user/bob . what's right way rename these user branches subgit import? you can use configuration trunk = trunk:refs/heads/master branches = branches/*:refs/heads/* branches = branches/users/*:refs/heads/users/* shelves = shelves/*:refs/shelves/* tags = tags/*:refs/tags/* or if want branches/users/jim translated refs/heads/james (and branches/users/bob refs/heads/robert ), use config trunk = trunk:refs/heads/master branches = branches/*:refs/heads/* branches = branches/users/jim:refs/heads/james branches = branches/users/bob:refs/heads/robert branches = branches/users/*:refs/heads/users/* shelves = shelves/*:refs/shelves/* tags = tags/*:refs/tags

php - Zend Form Input Element -

it's form class: <?php class application_form_message extends zend_form { public function init() { $this->setmethod('post'); $this->addelement( 'text', 'email', array( 'label' => 'e-mail', 'filters' => array('stringtrim'), 'class' => 'size-large-big', 'required' => true ) ); $this->addelement( 'text', 'subject', array( 'label' => 'subject', 'filters' => array('stringtrim'), 'class' => 'size-large-big', 'required' => true ) ); $this->addelement( 'textarea', 'content&

css - Border around a group of elements floated left? -

i have container div several items within it. container needs have border. problem need have elements floated left within container, , seems "remove" elements flow. when try add border container, doesn't go around elements, if not within container. <div class="container"> <div class="one"></div> <div class="one"></div> <div class="one"></div> <div class="one"></div> <div class="one"></div> <div class="one"></div> <div class="one"></div> <div class="one"></div> </div> .one { width:150px; height:50px; background:red; margin:5px; float:left; } .container { width:350px; border-style:solid; border-width:2px; border-color:black; } see: http://jsfiddle.net/ynwbzw97/ any ideas how work? you need

module - OCaml - Cannot find graphics.cma -

when loading graphics module in toplevel, error saying "cannot find graphics.cma". i'm using os x , i'm pretty sure i've installed ocaml correctly since i've been using month now. seems graphics module wasn't included in ocaml package. how can fix issue, or how can install graphics module myself? first of all, check graphics installed. library optional , therefore may not installed. there several ways check following should work situation: $ ls `ocamlc -where`/graphics* if there no file listed above command, graphics not installed , have reinstall ocaml compiler enabling graphics. if files graphics.cma there, have show how try compile code graphics. best answer varies depending on how compile: inside toplevel, hand compiling ocamlc, or build tool ocamlbuild.

Array with hex values in C++ -

for last day have had problems code. here want upload .txt several hexadecimal values , if sum of first 5 numbers equal last number, code correct.then, method main have check if rest methods succeeded. don't know how this, need help... #include <iostream> #include <fstream> #define filecode "file.txt" #define n_code 6 using namespace std; ifstream file; void uploadcode(bool& exist, unsigned int longcode, unsigned int code[]); bool isvalidcode(unsigned int code[]); void main() { unsigned int code[n_code]; bool exist; unsigned int longcode=n_code; isvalidcode(code); if(isvalidcode(code)==true){ uploadcode(exist,longcode,code); //here have problem because don't know how call method cout << "success" << endl; } else cout << "fail" << endl; } void uploadcode(bool& exist, unsigned int longcode, unsigned int code[]) { int i; file.open(file

list - Symbol '%' causes crash when used in android:summary tag -

i have declaration of preference list in preference.xml file: <listpreference android:key="pref_reflected_calibration" android:title="calibration constant" android:summary="select 18% dslr (default), 12.5% sekonics" android:entries="@array/reflected_calibration_entries" android:entryvalues="@array/reflected_calibration_values" android:defaultvalue="18"/> it causes crash error: "java.util.illegalformatconversionexception: %f can't format java.lang.string arguments" when remove '%' symbol android:summary tag, works ok. replacing '%' symbol unicode equivalent doesn't help. couldn't find explanation in documentation, ask question here in java % symbol precedes format specifier, causes error. escaping % symbols % should solve issue: android:summary="select 18%% dslr (default), 12.5%% sekonics"

colors - Fast approximate algorithm for RGB/LAB conversion? -

i working on data visualization tool using opengl, , lab color space comprehensible color space visualization of data i'm dealing (3 axes of data mapped 3 axes of color space). there fast (e.g. no non-integer exponentiation, suitable execution in shader) algorithm approximate conversion of lab values , rgb values? if doing actual conversion calculation in shader complex/expensive, can use lookup table. since both color spaces have 3 components, can use 3d rgb texture represent lookup table. using 3d texture might sound lot of overhead. since 8 bits/component used represent colors in opengl, need 256x256x256 3d texture. @ 4 bytes/texel, that's 64 mbyte texture, not outrageous, substantial. however, depending on how smooth values in translation table are, might able away lower resolution. keep in mind texture sampling uses linear interpolation. if piecewise linear interpolation enough base-resolution of lookup table, can reduce size. if go direction, , can'

php - Paypal REST Oauth giving redirect error -

paypal giving me error relying party validation error: redirect_uri provided in request not match registered redirect_uri. please check request. when trying oauth login box show up. have copy , pasted redirect_uri paypal code. this url i'm directing user to https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize?client_id=<myclientid>&response_type=code&scope=email&redirect_uri=<myredirecturl> note copy , pasted app return url (live) on https://developer.paypal.com/webapps/developer/applications/editapp any idea how past error? yes, contacted paypal , had "enable setting" on end. , said yes on end.

java - @SessionAttribute not being set -

i need help. i'm using portlet app usual when have out of computer. when return, there's nullpointerexception. ok, why's that? hmm... session doesn't contain object should hold. so, i'm loosing here's how looked @ sessionattributes. i have controller annotated so: @sessionattributes({ some_attr }) then have method following signature: @valid @modelattribute(some_attr) someobject someobject and init method session attribute: @modelattribute(some_attr) public someobject getsomeemptyobject() { return someutils.createsomeobject(); } when debugged app @ point found out that: manually looking session, there's nothing in it form binded someobject so 2 big questions are: why doesn't spring set someobject session well? when session invalidated, why wasn't getsomeemptyobject() called fill empty space? thanks in forward! have @ httpsessionbindinglistener , httpsessionattributelistener . if someobject class co

php - PHPExcel returns a weird date format -

when use phpexcel's getformattedvalue() on row / column that, in libreoffice calc, shows 02/19/2015 23:59:40 42067.458524537 back. how convert 02/19/2015 23:59:40 ? my php code follows: <?php include('/path/to/phpexcel.php'); $filepath = 'filename.xlsx'; $inputfiletype = phpexcel_iofactory::identify($filepath); $objreader = phpexcel_iofactory::createreader($inputfiletype); $excel = $objreader->load($filepath); $worksheet = $excel->getsheet(); echo $worksheet->getcellbycolumnandrow(3, 4)->getformattedvalue(); ms excel stores dates serialized value, real number count of number of days since baseline of either 1st january 1900 or 1st december 1904, depending on whether spreadsheet created using windows 1900 calendar or mac 1904 calendar. a serialized value of 42067.458524537 corresponds date of 4th march 2015 @ 11:00:17 (with windows 1900 calendar) if you've used phpexcel's getformattedvalue() method, should convert

javascript - Keeping a checkbox checked with local storage but also filter a list on load -

alright, is/was 2 part question, posted function: $(function () { var data = localstorage.getitem("filter-by"); if (data !== null) { $("input[name='filters']").attr("checked", "checked"); } }); $("input[name='filters']").click(function () { if ($(this).is(":checked")) { localstorage.setitem("filter-by", $(this).val()); } else { localstorage.removeitem("filters"); } }); as start re-checking checkbox after load using local storage. after trial , error able me write new function: $("input[name='filters']").click(function () { var items = localstorage.getitem("filter-by") || []; var data = this.data('filter-by'); if ($(this).is(":checked")) { items.push(data); } else if (items.indexof(data) >= 0) { items.splice(items.indexof(data), 1); } if (items.length > 0

Rebuild JSON after $http.get with AngularJS -

update following link provide working demo highchart-ng , json rebuild solution. if try use json data splunk in highchart, save day :) http://plnkr.co/edit/nl47hz5cnj1jvut3dtbt?p=preview -- i trying json response splunk fit highchart, im having real problems formating data right. i`m big fan of angularjs, have trubble wrapping head around it, , hope bright minds can me. i have been trying loops build data, no luck. if cant provide whole solution, please point me in correct direction ? :) original data $http.get: [ { "time": "2015-03-20 20:45:00", "output": { "80": 34, "443": 234, "993": 311, "8080": 434 } }, { "time": "2015-03-20 20:40:00", "output": { "80": 0, "443": 204, "993": 38, "808

php - Why does this LDAP query return an array with just a 0 -

i'm new ldap , active directory. i'm trying fetch email-id of authenticated user using following code. when run it, array 0 in it. here's code $server ='ldaps://domain'; $username = 'domain\uid'; $password = 'password'; $base_dn = 'dc=domain'; $search_filter = 'dn=uid'; $attributes = ['mail']; $ldap = ldap_connect($server); ldap_set_option($ldap, ldap_opt_referrals, 0); ldap_set_option($ldap, ldap_opt_protocol_version, 3); ldap_bind($ldap, $username, $password); $search = ldap_search($ldap, $base_dn, $search_filter, $attributes); $data = ldap_get_entries($ldap, $search); foreach($data $datapoint) { echo $datapoint; echo "<hr>"; } this outputs 0 horizontal line below it. the challenging thing here there no error message whatsoever , i'm not familiar ldap nor active directory. any idea why happening. i see several things potentially causing problems code

html - image size in ratio with div size without any stretch -

lets have div of heigh 400px , width 400px. <div style="width:400px; height:400px; background:#ccc;" align="center"> <img src="/static/{{media_info.media_file}}" /> </div> now if have image of height 350 , width 200 px want adjusted in div. mean adjust inside div being child div. should not fit div neither stretch. fit in center. like div should taken 100% , image should in ratio. remaining 50 px in height , 200 px in width should left. buttom , top leaving 25 25 px , left , right leaving 100 100 px. also if image of width 800px , height 700 px same way div height , width should considered 100 percent , image should lie in middle without stretch i not front end developer :( so want image centered inside div, in original size, , overflow cut of when image larger div in dimension? well set centered background-image, instead of using in actual img element. if that’s not option, position absolutely – -50% eith

html - Three javascript functions on one single page - disfunctional -

my first post here let's this. have single page website 3 image sliders on each div. 1 div after other: <script type="text/javascript"> var imagecount = 1; var total = 3; function slide(x) { var image = document.getelementbyid('img'); imagecount = imagecount + x; if(imagecount > total){ imagecount = 1;} if(imagecount < 1){ imagecount = total;} image.src = "img/slide1/img"+ imagecount +".jpg"; } </script> <script type="text/javascript"> var imagecount = 1; var total = 3; function slide(x) { var image = document.getelementbyid('img2'); imagecount = imagecount + x; if(imagecount > total){ imagecount = 1;} if(imagecount < 1){ imagecount = total;} image.src = "img/slide2/comd"+ imagecount +".jpg"; } </script> because have added code too, navigation buttons on first don't work first div second one. html: <div id="main-content"> <div id=&q

Django save an image asynchronous during a request -

i need save image on amazon ws s3 using django. have code: try: img_temp = namedtemporaryfile(delete=true) img_temp.write(urllib2.urlopen(urlimageto download).read()) img_temp.flush() p.image.save('image.jpg', file(img_temp)) p.save() //p imagefield except urllib2.httperror: continue i integrated django-storages save directly image in amazon s3. have save image during request (in request have url of image have download , resave in amazon s3) think can have line: p.image.save('image.jpg', file(img_temp)) asynchronous. in case can return response of request while can save image on s3 how can have this? possible?

http post - how can i send imagedata on server using httppost in android? -

i tried convert image data "string str=base64.encodetostring(imagedata, base64.default);" , tried send not working. even tried below, multipartentitybuilder builder = multipartentitybuilder.create(); builder.setcharset(mime.utf8_charset); builder.addbinarybody("file",imagedata); httppost.setentity(builder.build()); still can't send image. server url on trying send below, " http://192.168.1.8:88/erp/demo.nsf/(demo)?operation&file=imagedata " please give me suggestions. thank you. i don't think url supposed carry parameters. parameters use must added in builder text. here's code used same thing.: @override protected string doinbackground(string... params) { // todo auto-generated method stub string textfilename = params[0]; string message = "this multipart post"; string result =" "; httppost post = new httppost("

angularjs - Listening to `set_at` event using the ui-gmap-polygon -

i'm using drawingmanager allow users draw shapes on map. once shape drawn, set listener on polygon's path can react after path has been changed: var polygonpath = event.overlay.getpath(); google.maps.event.addlistener(polygonpath, 'set_at', function () { // code... }); this works great when user adds new shape using drawing tool. however, if have polygons in database displaying ui-gmap-polygon angularjs directive (from angular-google-maps project), how can listen set_at event since event not on polygon , instead, on polygon's path ( mvcarray )? the place able find reference set_at in source code of angular-google-maps project in array-sync.coffee file, doesn't being exposed. if can't listen set_at event directly using directive, hope there event gets triggered when directive creates polygon can polygon's path , add listener that, code above. i have put jsfiddle basic structure, along events object. handles polygon's mouseo

How do Openstack Keystone PKI certificates work? -

openstack keystone pki uses 2 certificates document mentions: https://www.mirantis.com/blog/understanding-openstack-authentication-keystone-pki/ ca certificate , signing certificate. my understanding far: signing key used sign user token while signing certificate contains corresponding public key , shared service endpoint used while decrypting user token. is correct? if so, purpose of ca certificate , ca key? i'd suggest openstack documentation @ http://docs.openstack.org/admin-guide-cloud/content/certificates-for-pki.html pki stands public key infrastructure. tokens documents, cryptographically signed using x509 standard. in order work correctly token generation requires public/private key pair. public key must signed in x509 certificate, , certificate used sign must available certificate authority (ca) certificate. tokens both signed , verified. there's no decryption. the certificate , certificate authority used can internal or external , how cloud pr

ios - NSImageView ClipsToBounds -

i have ios app uses code below. creating app mac os x , same effect not seem able use clipstobounds . should using? have rest of code working on mac, not part. thanks var myimage = uiimage() let view = uiimageview(frame: cgrectmake(0, 0, 100, 100)) view.contentmode = uiviewcontentmode.scaleaspectfill view.layer.opacity = opacity view.layer.cornerradius = cornerradius view.clipstobounds = true view.image = self.myimage self.mainview.addsubview(view) you should have showed cocoa code , had tried. in case, cocoa views clip bounds default. if don't want image scaled, set imagescaling property nsimagescalenone .

php - Laravel, response json data into controller and make json_decode into view -

i want make this, 1. controller return json data view $data = response::json(array('status' => false, 'code' => 205, 'message' => 'deneme', 'data' => null), 200 ); return view::make('site.index.index')->with('data', $data); 2. view make decode data , use. {{ $data2 = @json_decode($data) }} {{ var_dump($data2) }} json data going view don't decoding on array. how can decode data? $data = json_encode(array('status' => false, 'code' => 205, 'message' => 'deneme', 'data' => null)); return view::make('site.index.index')->with('data', $data);

java - How do i change the value of myDate1 and print out that new value within my main method? -

how use 3 individual set methods change mydate1 new date input? heres 3 set methods public void setmonth( int mm ) { month = ( mm >= 1 && mm <= 12 ? mm : 1 ); } /** setday * @param dd new value day * if dd legal day current month, sets day dd * otherwise, sets day 1 */ public void setday( int dd ) { day = ( dd >= 1 && isvalidday( dd ) ? dd : 1 ); } /** setyear * @param yyyy new value year * sets year yyyy */ public void setyear( int yyyy ) { year = yyyy; } i want keep code write main method. here rest of code. import java.io.serializable; // object i/o file import java.util.scanner; //public class simpledate public class simpledateclientfl implements serializable { private int month; private int day; private int year; public static void main(string[] args) { scanner input = new scanner(system.in); int month; int day; int year; simpledate mydate1 = new simpl

android - show only one of similar items in List -

i have list of numbers this: -153 -542 -153 -153 -783 -785 -975 -153 -478 as see "153" showen 4 times want show number 1 time this: -153 -542 -783 -785 -975 -478 edit: i need messages numbers show 1 if similar numbers here method: public static list<smsdata> getallnumbers(context context){ list<smsdata> smslist = new arraylist<smsdata>(); uri uri = uri.parse("content://sms/inbox"); cursor c= context.getcontentresolver().query(uri, null,null,null,null); // read sms data , store in list if(c.movetofirst()) { for(int i=0; < c.getcount(); i++) { smsdata sms = new smsdata(); sms.setbody(c.getstring(c.getcolumnindexorthrow("body")).tostring()); sms.setnumber(c.getstring(c.getcolumnindexorthrow("address")).tostring()); sms.setdate(c.getstring(c.getcolumnindexorthrow("date")).tostring()); smslist.add(sms);

javascript - Using a Brushed HTML Template -

i have done personalizing on template now, being not familar code. has modenizr.js attached, adds animated loading screen before opening site. problem don't want screen there doesn't disappear after page loaded sits ontop of site. any tips or guidance appreciated. thanks damianl. can complete question link, , explaining have done template please? anyway can suggest open "developer tools" (usually pressing f12) , using inspector trying figure out wich element doesn't disappear, , maybe why. im sorry, not real answer, don't have enough reputation add comment asking more info.

how to cut words and characters from a string in java -

i want remove string first word , first letter second word. way ? for example, string = "hello world!" result must be: "orld!" i tried using method substring didn't know how use properly. thanks int index = a.indexof(" "); string result = index == -1 || index == a.length() - 1 ? "" : a.substring(index + 2);

Is it possible to get the data type of mongodb collection fields using c#? -

i need create datatable stores result of mongodb query using correct data type of fields (string ,double...). here code using here specifying type of created column string type need find way correct type of field: var connectionstring = "mongodb://localhost"; var client = new mongoclient(connectionstring); var server = client.getserver(); var database = server.getdatabase("test"); var collection = database.getcollection("doc1"); datatable dt; datacolumn column; int = 0; dt = new datatable(); string map = @"function() { (var key in this) { emit(key, null); } }"; string reduce = @"function(key, stuff) { return null; }"; string finalize = @"function(key, value){ return key; }"; mapreduceargs args = new mapreduceargs(); args.finalizefunction = new bsonjavascript(finalize); args.mapfunctio

How do I get a list of unit tests in clojure? -

i using deftest define unit tests (the tests generated macro, why identifiers qualified): (clojure.test/deftest init-globals-test (clojure.test/is (clojure.core/= 40 casc-gen-org.dev/*board-width*)) (clojure.test/is (clojure.core/= 40 casc-gen-org.dev/*board-height*))) however when run tests: (run-tests) i following: : #'casc-gen-org.dev/clj-run-runtime-uts{:type :summary, :fail 0, :error 0, :pass 6, :test 3} it says have 3 tests , 6 assertions (assuming i'm reading right), expected 1 test , 2 assertions. assume have stale tests in repl somwhere , i'd delete them. i looked @ doc deftest ( https://clojure.github.io/clojure/clojure.test-api.html ) , don't see related listing tests. how list tests defined? clojure.test manual search / filter find vars :test metadata, , vars found metadata key considered tests. can same, , list vars considered unit tests small function of no arguments: #(->> (all-ns) (m

ios - Multipart upload using Quickblox for large files -

i using quickblox backend service , far has been great, having trouble uploading large video files. here's how upload video files using quickblox ios sdk: [qbrequest tuploadfile:self.videodata filename:@"testing" contenttype:@"video/quicktime" ispublic:yes successblock:^(qbresponse *response, qbcblob *blob) { //success } statusblock:^(qbrequest *request, qbrequeststatus *status) { // update progress nslog(@"completion : %f", status.percentofcompletion); } errorblock:^(qbresponse *response) { // }]; this works fine of time, when self.videodata bigger, 20mb, app crash. after doing research on stackoverflow, looks right way upload large files server without crashing app multipart upload. how can multipart upload quickblox? i'm willing use rest api if ios sdk not work. i need know if possible or not, , if yes how started.

entity framework - EF 6.1.3 automatic migrations -

i created initial migration database when executed database operation via code first. all tables got created successfully. i have enabled automatic migrations. i've added couple of columns model. when run "update-database –verbose", error message (which understand, don't why it's coming out) of " there object named 'categories' in database. " the categories table along rest of tables got created on initial migration (as explained above). i made change (adding 2 other columns) model (customer). i think, code first migration @ entire dbset model, determine changed, apply necessary sql. instead, it's trying create categories table again exists. can please explain me how can update db without happening? doing wrong or need in order work.... edit successful creation of ef code-first migrations setup: enable-migrations -enableautomaticmigrations add-migration initial (creates _initial.cs file). comment out code in _in

Rails: invite to sign up as friend with devise gem -

i'm using devise in rails app. want user can give link friends, , through link, can sign , become friends inviter. here come with. first, give every user unique code, dbgadf34t42a , , people visit url localhost/signup?invite_code=dbgadf34t42a . customize devise's sign controller , use code find inviter , create friendship relationship. code like def create #create user account, , create friendship invite_code = paramsp[:invite_code] if user.save inviter = user.find_by_invite_code(invite_code) inviter.friendships.create(friend: user) end end i'm wondering if there better way of doing this, gems or codes. i didn't find resources on customize devise's signup controller , can extract logic place, store invite code, , continue creating friendship model? perhaps like: def after_sign_up if params[:invite_code] redirect_to new_friendship_path else # default_behavior end end i

java.lang.ClassNotFoundException with IntelliJ -

i've been searching solution works none have far. when try run program known work others, error: "c:\program files\java\jdk1.7.0_65\bin\java" -didea.launcher.port=7534 "-didea.launcher.bin.path=c:\program files (x86)\jetbrains\intellij idea 14.0.3\bin" -dfile.encoding=utf-8 -classpath "c:\program files\java\jdk1.7.0_65\jre\lib\charsets.jar;c:\program files\java\jdk1.7.0_65\jre\lib\deploy.jar;c:\program files\java\jdk1.7.0_65\jre\lib\javaws.jar;c:\program files\java\jdk1.7.0_65\jre\lib\jce.jar;c:\program files\java\jdk1.7.0_65\jre\lib\jfr.jar;c:\program files\java\jdk1.7.0_65\jre\lib\jfxrt.jar;c:\program files\java\jdk1.7.0_65\jre\lib\jsse.jar;c:\program files\java\jdk1.7.0_65\jre\lib\management-agent.jar;c:\program files\java\jdk1.7.0_65\jre\lib\plugin.jar;c:\program files\java\jdk1.7.0_65\jre\lib\resources.jar;c:\program files\java\jdk1.7.0_65\jre\lib\rt.jar;c:\program files\java\jdk1.7.0_65\jre\lib\ext\access-bridge-64.jar;c:\program files\java\jdk1

c - Initializing a malloc'ed string index to NULL -

for example, created char **strings using malloc. how set each index strings[i] null? set null? because when check function index equal null, if(strings[i] == null); never seems work. help? sorry i'm new dynamic memory.. null defined macro expands (void *)0 you can use calloc allocate , initialize zero. char* buffer = calloc(4, sizeof(char); if(*buffer == 0) { printf("%s\n", "*buffer == 0"); }

Sending binary data multiple times using Sockets in Java/Android -

i need send binary data multiple times java sockets on android devices. simple object exports run() , send() methods. public class gpcsocket { private socket socket; private static final int serverport = 9999; private static final string server_ip = "10.0.1.4"; public void run() { new thread(new clientthread()).start(); } public int send(byte[] str) { try { final bufferedoutputstream outstream = new bufferedoutputstream(socket.getoutputstream()); outstream.write(str); outstream.flush(); outstream.close(); } catch (unknownhostexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } catch (exception e) { e.printstacktrace(); } return str.length; } class clientthread implements runnable { @override public void run() { try { ine

php - Laravel - PHPUnit simple test failed -

i don't understand... first test phpunit works fine. added new route , new method of course. route::get( '/about', 'homecontroller@about' ); so, changed line inside exampletest: public function testbasicexample() { $response = $this->call('get', '/about'); $this->assertequals(200, $response->getstatuscode()); } and gives me error: failed asserting 302 matches expected 200. what doing wrong? public function testbasicexample() { $response = $this->call('get', '/about')->response; $this->assertequals(200, $response->status()); }

ITHit webdav EditDoc js not working in ios browsers -

we have used ithit ajax library open documents browser using editdocument javascript method. (ithit.webdav.client.docmanager.editdocument) all works fine in desktop browsers.(safari/chrome/ie/firefox) but when try iphone/ipad browsers, javascript method invoked document opening not triggered. even though hit webdav ajax library runs both in mobile , desktop web browsers, supports document editing in desktop web browsers only. it using components installed microsoft office (in case of ms office docs , if ms office found) or java applet in other cases mount drive , open document. unfortunately ios, android , win phone not provide drive mounting capabilities. many mobile applications has built-in webdav support. example here can find how open documents in iwork on ios.

ruby on rails 4 - Heroku not locating redis server -

still having trouble connecting redis on heroku. works fine locally. i installed 'redis' gem , located redistogo_url within heroku website. added production env variable heroku. when try run carrierwave backgrounder process depends on redis , sidekiq, keep getting error below. redis.rb uri = uri.parse(env["redistogo_url"]) redis = redis.new(host: uri.host, port: uri.port, password: uri.password) in config file if rails.env.development? env['redistogo_url'] = 'redis:://@localhost:6379' else env["redistogo_url"] = 'redis://redistogo:my_hash_key@greeneye.redistogo.com:9286/' end error 2015-03-21t04:44:47.560613+00:00 heroku[router]: at=info method=post path="/photos" host=www.luminoto.com request_id=92ad0e79-45c4-413d-8dc6-b3fdfe1754b8 fwd="98.222.43.13" dyno=web.1 connect=1ms service=1396ms status=302 bytes=1609 2015-03-21t04:44:47.560695+00:00 app[web.1]: error connecting redis on 127.0.0.1:

android - DataInputStream.readUTF is not receiving any string from Node.js Server -

today writing app (android) received strings server in node.js. socket connection fine, can send android server fine, when comes receiving server, readutf() stuck @ reading. here's android code send , receive: socket socket = new socket("10.13.37.129",1337); dataoutputstream dataoutputstream = new dataoutputstream(socket.getoutputstream()); jsonobject jsonobject = new jsonobject(); jsonobject.put("data", "tristen"); dataoutputstream.writeutf(jsonobject.tostring()); datainputstream datainputstream = new datainputstream(socket.getinputstream()); system.out.println("receiving"); final byte[] buffer = {}; datainputstream.read(buffer); string = new string(buffer); sy

geolocation - Read site html from a site in a different geo region -

i using python , beautiful soup read html pages. unfortunately sites redirect geo region (au) can't retrieve target countries version i.e. (uk, us, fr, nz...) i have tried using vpn service requires me manually change region can't automate process. have tried using python quartz.coregraphics library click options on screen temperamental. is there way can achieve programmatically? i have manage nut 1 out myself. best answered example reading uk based site. import urllib2 url = 'some-uk-url' req = urllib2.request(url) req.add_header('accept-language', 'en-gb') req.add_header('x-forwarded-for', [a uk proxy ipaddress here]) htmltext = urllib2.urlopen(req).read()

Orientdb community edition 2.0 intallation steps for window bit 64 -

hi need steps installing orientdb 2.0 in windows.followed link http://www.orientechnologies.com/docs/last/windows-service.html better easy steps or video tutorial may helpful. unzip orientdb 2.0.5 distribution from command: \bin\server.bat choose password go http://localhost:2480/ favorite browser

c++ - Proper way to determine thresholding parameters -

Image
i trying find triangles (blue contours) , trapezoids (yellow contours) in real time. in general it's okay. there problems. first it's false positives. triangles become trapezoids , vice versa. , don't know how how solve problem. second it's "noise". . tried check area of figure, noise can equal area. did not much. noise depends on thresholding parameters. cv::adaptivethreshold does not @ all. it's adds more noise (and slow) erode , dilate cant fix in proper way and here code. cv::mat detect(cv::mat imagergb) { //rgb -> gray cv::mat imagegray; cv::cvtcolor(imagergb, imagegray, cv_bgr2gray); //bluring cv::mat image; cv::gaussianblur(imagegray, image, cv::size(5,5), 2); //thresholding cv::threshold(image, image, 100, 255, cv_thresh_binary_inv); //slow , noise //cv::adaptivethreshold(image, image, 255.0, cv_adaptive_thresh_gaussian_c, cv_thresh_binary, 21, 0); //calculating canny params. cv::sc

android - Circular,Elliptical and Arc motion in Universal Tween Engine -

Image
i use universal tween engine in libgdx based android game. know if there in-built function circular or elliptical motion in universal tween library. my requirement move object in below mentioned path (to , fro). trying achieve using inbuilt function. please advice if achievable

java - How do I seperate date and time from this below code can anybody help me -

string pickup = date format. date time instance( date format. short, date format. short).format( tree.pickup); gives output 3/21/15 5:58 am . i'm trying output date 3/21/15 , time 5:58 am how can achieve this? you can try code also, try use date time formats. import java.text.dateformat; import java.text.simpledateformat; import java.util.calendar; public class j2 { public static void main(string[] args) { dateformat f1 = new simpledateformat("yyyy/mm/dd"); dateformat f2 = new simpledateformat("hh:m:s:a"); calendar cal = calendar.getinstance(); string date = f1.format(cal.gettime()); string time = f2.format(cal.gettime()); system.out.println(date); system.out.println(time); } }

ruby - how to fix install network_interface gem on windows -

when want run msfconsole see error : f:\metasploit\apps\pro\msf3>ruby msfconsole not find network_interface-0.0.1 in of sources run bundle install install missing gems. when execute 'bundle' install : f:\metasploit\apps\pro\msf3>bundle install fetching gem metadata https://rubygems.org/......... fetching version metadata https://rubygems.org/.. resolving dependencies..... using rake 10.4.2 using i18n 0.6.11 using multi_json 1.0.4 using activesupport 3.2.21 using builder 3.0.4 using activemodel 3.2.21 using erubis 2.7.0 using journey 1.0.4 using rack 1.4.5 using rack-cache 1.2 using rack-test 0.6.2 using hike 1.2.3 using tilt 1.4.1 using sprockets 2.2.3 using actionpack 3.2.21 using mime-types 1.25.1 using polyglot 0.3.5 using treetop 1.4.15 using mail 2.5.4 using actionmailer 3.2.21 using arel 3.0.3 using tzinfo 0.3.42 using activerecord 3.2.21 using activeresource 3.2.21 using arel-helpers 2.1.0 using ffi 1.9.3 using c