Posts

Showing posts from January, 2010

django settings error (DB Engine) when I moved all of my apps to "apps" directory (SOLVED) -

i changed traditional django layout, , decided put of apps apps directory. the initial layout : project/ apps/ myapp/ __init__.py tests/ __init__.py setting.py urls.py wsgi.py manage.py within settings.py set normal engine , name : import os project_path = os.path.dirname(os.path.abspath(__file__)) 'engine': 'django.db.backends.sqlite3', 'name': os.path.join(project_path, 'dev.db'), and within installed_apps , i've tried both project.apps.myapp , apps.myapp , no success. here engine error : settings.databases improperly configured. please supply engine value. check settings documentation more details. there should problem new layout ... i've seen solutions, none of them supposed such django layout ... any idea ? p.s. can see , i'm using django 1.4+ layout update : ok .. solved it. for record 1 : if decide change default layout, careful settings.py . added settin

html - C# Getting Text from object in web page -

i'm trying recreate old c# application of mine streams online radio station. problem old 1 is, loaded entire web page display area of it, takes more resources deem necessary. so, i'm rewriting entire application, , looking way how can retrieve text following code on website: <div id="now" style="visibility: visible; display: block;"> <div class="scroll" style="margin-left: 0.000px;"> <div id="title">song_name</div> <div id="artist">song_artist</div> </div> </div> this piece updated on page, name , artist of current song. id="title" name of song , id="artist" artist of song. i retrieve name , artist every say, 10 seconds or so. any idea code use ? you'll want pull entire page back. main considerations are: you request html uncompressed , open stream using httpwebresponse.getresponsestream , rea

fennec - How can I enable Firefox for Android reader mode for my site? -

i'm creating site responsive, , suitable mobile devices. earlier discovered firefox's reader mode, available sites, , provided clean view reading. however, when visit site, don't option view in reader mode. i'm curious how possible enable site, since it's great feature. reader mode in firefox android based on readability.js code , publisher guidelines readability should help: https://www.readability.com/developers/guidelines

android - How to use addRule() with a tag dynamically inside a loop it takes Exception when inflating View? -

i have loop add variable number of views relativelayout, , want set rules below , problem i'm using tags name objects dynamically, , use addrule() method need use id, tried set id every time loop runned , it's not first time. this code: for(int = 1; <= knumberofviews; i++){ view = new myview(context); relativelayout.layoutparams params = new layoutparams(kviewwidth, kviewheight); params.setmargins(kmarginleft, kmargintop, kmarginright, kmarginbottom); params.addrule(center_horizontal); if (i != 1){ myview view = (myview)view.findviewwithtag(i-1); view.setid(i); params.addrule(relativelayout.below, view.getid()); } view.settag(i); view.setbackgroundcolor(color.green); system.out.println("view " + +" added correctly"); addview(view, params); } how can solve it? edit: 05-18 14:57:19.549: e/androidruntime(5500): fatal exception: main 05-18 14:57:19.549: e/androidruntime(5500): java

ruby - Heroku error "We're sorry, but something went wrong" -

i have problem publish ror project heroku.com service... have done steps tutrial but when running comand "heroku open" have error "we're sorry, went wrong", i'm doing wrong? i have been migrated database, think error connected whith database, here heroku log: 2013-05-18t12:33:19.546366+00:00 heroku[slugc]: slug compilation started 2013-05-18t12:34:56.655486+00:00 heroku[api]: scale web=1 vladimir90@inbox.lv 2013-05-18t12:34:57.187082+00:00 heroku[api]: attach heroku_postgresql_copper resource vladimir90@inbox.lv 2013-05-18t12:34:57.224557+00:00 heroku[api]: release v3 created vladimir90@inbox.lv 2013-05-18t12:34:57.308368+00:00 heroku[api]: add database_url config vladimir90@inbox.lv 2013-05-18t12:34:57.349978+00:00 heroku[api]: release v4 created vladimir90@inbox.lv 2013-05-18t12:34:57.408192+00:00 heroku[api]: add config vladimir90@inbox.lv 2013-05-18t12:34:57.442261+00:00 heroku[api]: release v5 created vladimir90@inbox.lv 2013-05-18t12:34:

php - CodeIgniter, Smarty and Form Helper. Wrong Link on Submit -

i have al litte problem using codeigniter form helper , smarty. i used ( https://github.com/ellislab/codeigniter/wiki/form-helper-with-smarty ) form helper function. now have adduser() function in controller public function adduser(){ $this->load->helper('form'); $this->form_validation->set_rules('username', 'benutzername', 'trim|required|min_length[4]|xss_clean'); $this->form_validation->set_rules('email', 'email', 'trim|required|valid_email'); $this->form_validation->set_rules('password', 'passwort', 'trim|required|min_length[4]|max_length[32]'); $this->form_validation->set_rules('con_password', 'passwort bestätigen', 'trim|required|matches[password]'); if($this->form_validation->run() == false){ echo "error! user can not create"; }else{ $thi

java - Problems with Brick Collision Detection in BreakOut game -

i've done first breakout game while completing assignment stanford university cs online course java. however noticed during play testing when ball hits brick while travelling diagonally ends hitting several bricks in row in unnatural way. i'm guessing have improve bit collision detection code , tried several things no avail. i'm using acm library program. imaginary rectangle surrounds ball , use 4 corners of rectangle detect collision. during game, since added several addons (items drop , give bonus) there lot of velocity changes in game - vx variable change lot. i think related problem, because noticed it's when ball travels @ more speed more of several bricks destroyed in row problem. i´ll add relevant code here. can check out of code here: https://gist.github.com/frodosda/5604272 // defines initial direction of ball - inside "moveball" method vx = rgen.nextdouble(1.0, 3.0); // random horizontal direction if (rgen.nextboolean(0.5))

Install postgresql 9.2 on debian wheezy (on virtualbox) -

i have virtualbox debian wheezy. i'm trying install postgresql 9.2 on it. when trying this instruction have next: reading package lists... done building dependency tree reading state information... done packages not installed. may mean have requested impossible situation or if using unstable distribution required packages have not yet been created or been moved out of incoming. following information may resolve situation: following packages have unmet dependencies: postgresql-9.2 : depends: postgresql-common (>= 135~) not going installed depends: ssl-cert not installable e: unable correct problems, have held broken packages. when try install postgresql-common: apt-get install postgresql-common i got next: reading package lists... done building dependency tree reading state information... done packages not installed. may mean have requested impossible situation or if using unstable distribution required packages have not yet been created or been

jQuery Validate doesn't remove error if value is auto-inputted via JavaScript -

my html looks this: <form id="mainform" method="post"> <input type="text" class="required" name="receiver" /> <span id="clickme">click me</span> <input type="submit"> </form> and javascript follows: $(document).ready(function () { $("#clickme").click(function() { $("input[name=receiver]").val("clicked"); }); $("#mainform").validate({ submithandler: function (form) { alert("success!"); return false; } }); }); fiddle: http://jsfiddle.net/y9rft/2/ if submit leaving input empty, error appears. if click 'click me' span, input auto-filled, error remains until submit form. if type instead, error disappears instantly. is there way emulate user input error disappears on click? simply use the built-in .valid() method force immediat

Android:TextView height doesn't change after shrinking the font size -

Image
when click on button, font size shrinks 12. however, result : main.xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <textview android:id="@+id/test" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="40sp" android:background="#80ff0000" android:text="@string/hello" /> <button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button" /> </linearlayout> java: public class fontsizetestactivity extends activity { /*

C++ copy constructor by pointer -

hello want create new class variable pointer , initialize copy constructor. though know how copy constructor works refernce, cannot figure out how it. can me? example have definition: class a{ public: int a; private: }; and in code segment following: a *object= new a; a->a=10; *newobject= new a(*object); but segmentation fault. can me? tried: *newobject= new a(&(*object)); but doesn't work either. with kind of simple example, following uses default bit wise copy constructor works fine. the simple class looks like class bclass { public: int ivalue; }; and code use copy constructor looks like: bclass *pobject = new bclass; pobject->ivalue = 10; bclass *pobject2 = new bclass (*pobject); using microsoft visual studio 2005, above works fine. see implementing copy constructor . see copy constructor pointers objects .

.net - Alpha shape (concave hull) algorithm in C# -

i'm in need of concave algorithm outline shape set of points, there implementation in aforge.net use, have read somewhere aforge.net has implementation of algorithm can't find in documentation. any appreciated, best regards, daniel i know aforge dont have concave hull. need use emgucv if want compute it.

c - Why does console program print directory list rather than command line arguments? -

i doing exercise question 5-10 in k&r (the c programming language), , unable understand behavior of simple c code. #include<stdio.h> int main(int argc, char *argv[]) { int ctr = 1; if(argc == 1) printf("usage: reverse polish notation evaluator\n"); else { printf("total count : %d\n", argc); while(argc-- > 1) printf("%s\n", argv[ctr++]); } return 0; } this code working fine arguments except " * " (without quotes) character. when " * " given argument, code prints name of files present in directory. default behavior or has meta characters or doing wrong ? this has shell . shell expands * character space-separated list of files in current working directory.

java - Hibernate : merge detatched instance data in to persistent instance -

session session = hibernateutil.getsessionfactory().opensession(); transaction tx = session.begintransaction(); course c1 = (course) session.get(course.class, 1); tx.commit(); session.close(); c1.setcategory("science"); c1.setfee("3000"); //c1 became detached instance here session = hibernateutil.getsessionfactory().opensession(); tx = session.begintransaction(); course c2 = (course) session.get(course.class, 1); c2.setcategory("social"); c2.setrecommendedbook("modern history"); session.merge(c1); tx.commit(); session.close(); lets initial db table data is category = maths fee=1000 recommendedbook= maths magic thought above code copy uncommon fields c1 c2, , override common fields of c2 c1. expected result category = science fee=3000 recommendedbook= modern history copied entire c1 data c2 , updated db c1, , c2 data lost.actual result is category = science fee=3000 recommendedbook= maths magic infact not merging, overriding. ho

@media only screen and (max-width: 545px) property not working -

this site.. http://debt-trust.co.uk/home problem media screen css not working @ max width 545px... bu effect if max width of browser in @490px there can problem. thanks @media screen , (max-width: 545px){ .main-navigation { margin-top: 0px; background: #b5e61d; padding-bottom: 4px; padding-top: 3px; } #rightlogo{ width: 50%; } } i got solution of problem there issue in hosting sites there error during updating there hosting site

java - OnClickListener throws NullPointerException on startActivity -

i using android api 17 android development tools (adt) have help buttton listening click event. helpbuttonlistener listening click event help button following: excerpt mainactivity.java private final class helpbuttonlistener implements onclicklistener { public void onclick(view v) { intent maintohelpintent = new intent(mainactivity.this, helpactivity.class); startactivity(maintohelpintent); } } following code helpactivity works fine ans shows me some helpful stuff.. on helpactivity creation: public class helpactivity extends roboactivity { @override protected void oncreate(bundle savedinstancestate) { textview helptextview = new textview(helpactivity.this); helptextview.settext("some helpful stuff.."); setcontentview(helptextview); } } but if try use set text in textview view component injected using roboguice 2 inject textview using following code, gives me nullpointerexcepti

ios - CGPoint values in setContentOffset -

so, i'm making scroll , scroll down button on uiwebview . ideally, user have option scroll through finger, or tapping button. when tap button, scroll down inch or so. code i'm working (thanks danypata): //scroll up: -(ibaction)scrollcontentup:(id)sender { [_viewweb.scrollview setcontentoffset:_viewweb.scrollview.contentoffset.y - 10.0 animated:yes]; } //scroll down: -(ibaction)scrollcontentdown:(id)sender { [_viewweb.scrollview setcontentoffset:_viewweb.scrollview.contentoffset.y + 10.0 animated:yes]; } the issue lies 10.0. i'm getting error: sending double parameter of incompatible type cgpoint (aka struct cgpoint) i've never worked cgpoints before, , have tried researching them goes way o ver head. know plug code achieve scroll effect? in code passing float value in place ofcgppoint that's why getting error. set cgpointmake(x,y) value contentoffset value. [_viewweb.scrollview setcontentoffset:cgpointmake(0,_viewweb.scrollview.co

ruby - Destroy dependent objects in Rails using one transaction -

please, optimize object destroing in rails application: have relatively big database, , when want delete user dependent objects removing takes > 1 minute. it's long. database has indexes field, used find data, without indexes takes > 5 minutes. i see every 1 query takes little time: 0.1 - 1ms. there many queries. question is: how can tell rails remove related objects using 1 database transaction? think should speed operation , other operations too. thanks if want delete object , of it's dependancies, use destroy method: post.last.destroy if want destroy posts , use destroy_all method: post.destroy_all

vb.net - record cellmouseclicks in a datagridview - use indexes of clicks made in datagridview as indexes in a matrix or array -

i hope me. many in advance. my question related catching number of mouseclicks in datagridview. using visual basic in visual studio 2012. i building matrix or array size 10x10 populated 1's. have datagridview same size. aim put 0 in place of matrix has same coordinates "rowindex" , "columnindex" click performed using mouse in datagridview. till point having success. but want go further: want have many zeros in 1's matrix clicks on datagridview. problem can have 1 zero, last one. if perform click in datagridview(1,1), datagridview(2,2) , datagridview(3,3) have 0 in place (3,3) i not able record clicks made. here have code: private sub clickmouse(sender object, e datagridviewcellmouseeventargs) handles datagridview.cellmouseclick msgbox(e.clicks & e.columnindex & e.rowindex) dim matrix integer(,) = populatematrix() matrix(e.columnindex, e.rowindex) = 0 matrixtomatrixdef(matrix) end sub private function populate

python - Formatted headers/footers? Colour Code -

i've found out way format header , footer using xlwt (see https://groups.google.com/forum/?fromgroups#!topic/python-excel/3hzp_hk_lsc ), i'm looking docs or example on how define font color header , footer? example. according xlwt docs , can manage font, font style , font height. may have found there special &k (e.g. red &kff0000 ) notation header/footer font color, doesn't work xls (2003) format files. if ok generate xlsx instead - can choose openpyxl or xlsxwriter . here's example using openpyxl : from openpyxl import workbook wb = workbook() ws = wb.worksheets[0] ws.header_footer.center_header.font_size = 14 ws.header_footer.center_header.font_name = "tahoma,bold" ws.header_footer.center_header.text = "hello, world!" ws.header_footer.center_header.font_color = "ff0000" wb.save('output.xlsx') here's example using xlsxwriter : from xlsxwriter.workbook import workbook workbook = workbook

database - Optimizing MySQL ORDER BY field of JOINed table -

i have following structure: create table `tbl1` ( `id` int(11) not null auto_increment, `tid` int(11) not null, `user_id` int(11) not null, `time` datetime not null, `count` int(11) not null, primary key (`id`), unique key `tid_uid` (`tid`,`user_id`), key `tid_time` (`tid`,`time`) ) create table `tbl2` ( `id` int(11) unsigned not null auto_increment, `user_id` int(11) unsigned not null, `field_to_order_by` int(11) unsigned not null, primary key (`id`), unique key `user_id` (`user_id`), key `field_to_order_by` (`field_to_order_by`) ) i'm trying perform following query: select * tbl1 left join tbl2 on tbl1.user_id=tbl2.user_id tbl1.tid=13 , time > date_sub(now(), interval 1 week) order tbl2.field_to_order_by desc limit 200 the performance problem i'm facing due order by of joined table field. if remove or replace where condition on same field i'm getting massive improvement. how/can achieve reasonable performance combination of joi

html - div width fit to its content and overflow its parent -

take @ html: <div class="parent_container"> <div class="container"> <div class="item"> <img src="http://mountainguides.com/wordpress/wp-content/uploads/2010/11/illinizas-photo-ty-gimenez.jpg"/> </div> <div class="item"> <img src="http://mountainguides.com/wordpress/wp-content/uploads/2010/11/img_0700.jpg"/> </div> </div> </div> i'm trying make div: item line in 1 row , div: container width auto resize fit children. don't know number of div: item can't specific width div: container . here jsfiddle: http://jsfiddle.net/trongcuong1710/cdqsj/4/ .container { position:absolute; float:left; width: 100%; min-width:1px; } is this (jsfiddle.net/cdqsj/7/) want?

c++ - Polymorphism & default values: can co-exist? -

this question has answer here: virtual function default arguments behaviour 6 answers i have base class number of inherited derived classes. this: class { public: virtual void f(string foo = "bar") { cout << foo << endl; } }; class b: public { public: void f(string foo = "howdy") { cout << foo << endl; } }; class c: public { public: void f(string foo = "something") { cout << foo << endl; } }; i inherited 2 classes brevity. main: a* aarray[] = { new b, new c, }; int main() { aarray[0]->f(); aarray[0]->f(); return 0; } when run program, output is: bar bar just how if compiler ignores default arguments of overridden functions. normal, or there i'm doing wrong or i'm missing? default values statical

iphone - how can I run "cut" command in my ipad -

i want run bash shell script file in ipad. there cut in script. shell can not find command. package should install? coreutils known gnu core utilities

c# - ArgumentNullException while selecting inner node value in xml -

i'm trying location name value xml document given below, shows argumentnullexception . appreciated <response xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <copyright> copyright © 2011 microsoft , suppliers. rights reserved. api cannot accessed , content , results may not used, reproduced or transmitted in manner without express written permission microsoft corporation. </copyright> <brandlogouri> http://dev.virtualearth.net/branding/logo_powered_by.png </brandlogouri> <statuscode>200</statuscode> <statusdescription>ok</statusdescription> <authenticationresultcode>validcredentials</authenticationresultcode> <traceid> dd31ffaf098f4406b7ecdd0da36680ff </traceid> <resourcesets> <resourceset> <estimatedtot

sql union same parameters for two where = how to change it to one parameter -

i have query select last_name, job_id, department_name, country_name, hire_date , sysdate, salary employees e , departments d , locations l , countries c e.department_id = d.department_id , d.location_id = l.location_id , l.country_id = c.country_id , upper(last_name) upper('%&name%') union select last_name, j.job_id, department_name, country_name, start_date , end_date, to_number(null) employees e , job_history j , departments d , locations l , countries c j.department_id = d.department_id , d.location_id = l.location_id , l.country_id = c.country_id , j.employee_id = e.employee_id , upper(last_name) upper('%&name%'); as see on both select in union 'like upper('%&name%')' way don't ask both time pass first select second in union? thank answers. in databases, can use cte: with t ( select last_name, job_id, department_name, country_name, hire_date,

ruby on rails - why is display:block css only staying open momentarily -

i have rails app profile pages allow users post different types of information themselves. on left side of page, there is, example, link says "add job," when clicked displays form (originally hidden through css display:none; ) lets user add details job they've had. link in 'span2' column in html below. if user has entered details of job in database, information appear in middle 'span6' column , then, if user wants add details of job had, job form open in 'span3' column on right. however, if there no jobs in db, job form appear in middle because there's no content pushing right. the site uses backbone change css display: none display: block , this. "click .addjob": "showjobform" showjobform: function(){ $('.jobform').css('display', 'block'); }, problem: when click on link 'add job,' form flashing on page , disappearing. there 3 factors affect behavior: the form

ajax - Second click on button to send form? -

i'm working on delete function in web app clicking on button deletes row in db. pretty straight forward , works, want user able confirm delete first before form submitted. here's markup form now: echo '<li class="fave-item">'; echo '<div class="tasted-this box-center">'; echo '<form class="delete-fave">'; echo '<input type="hidden" name="user_id" value="'.$faves_result['user_id'].'" />'; echo '<input type="hidden" name="beer_id" value="'.$faves_result['beer_id'].'" />'; echo '<button class="icon delete" data-icon="x" />'; echo '</form>'; echo '</div>'; echo '</li>'; and here's ajax submit func.: $('.delete-fave').on('submit', function(){ $.ajax({ type: "post",

android - Opening create message using an intent -

i have following code displays create message screen. string uri= "smsto:"; intent intent = new intent(intent.action_sendto, uri.parse(uri)); intent.putextra("compose_mode", true); startactivity(intent); however, when intent called, asked choose list of apps messages, whatsapp, skype, etc. possible app directly open messages instead of asking user choose option? no not possible. sending implicit intent requesting perform task, intent can caught application register intent filter same intent name. not have control on selecting application directly a number of application same intent filter.

windows phone 7 - WP7/8 is it possible to turn on Flash Light with PhotoCamera -

i have photo app flashmode support can decide use autoflash, no flash or flash every picture taken. no want implement flash lights scene view on qr-codes example. user has click on flashmode button switch modes: flashmode.auto, flashmode.on, flashmode.off , new 1 "use flash led torch" ... possible in windows phone 7 / 8 ? thx in windows phone 8 can natively, audiovideocapturedevice , property videotorchmode=on. on windows phone 7 need use reflection , load "microsoft.phone.media.extended" library audiovideocapturedevice , turn on flash while you'r recording video. that useful use flashlight in wp7. http://www.locked.nl/wp7-flashlight-getting-started

algorithm - clustering a set of rectangles -

Image
i have set of rectangles need cluster together, based on euclidean distance between them.the situation explained in attached image. . one possible approach take center of each rectangle , cluster center points using k means (distance function euclidean distance in xy plane). however, know if there other approach problem, not approximate rectangle it's central point, takes actual shape of rectangle consideration. have @ algorithms such dbscan , optics can used arbitrary data types long can define distance between them (such minimum rectangle-to-rectangle distance). k-means not good, designed point data squared euclidean distance (= sum of squares, within-cluster-variance).

css - How to I change the color for the navigation bar in Foundation 4? -

here's website - http://foundation.zurb.com/docs/components/top-bar.html i've tried change every possible bit of css related navbar still haven't found way change it's color. could point me right path? want change background-color it's original blackish color color. the problem you've set colours on individual parts of navigation bar override overall colour via. more specific selectors. follow 3 steps below: first part of problem: .top-bar-section li a:not(.button) { //here first part of problem is. change different color. color:black; } please note part above change color of elements selector (the item 1 drop down menu in page uses this, change colour of drop-down unless give different selector). second part: .top-bar-section > ul > .divider, .top-bar-section > ul > [role="separator"] { //here second part of problem is. change different color. border-left: solid 1px black; border-right: soli

c++ - Text not rendering at all with FreeType/GLFW -

i'm getting clear color; text not rendering, , shaders not giving out errors; debug output initializing freetype version 2.4.10... opening font file freesans.ttf... loading glyph set , shaders... compiling shader textshader.vs... compiling shader textshader.fs... linking program... drawing text... 16.666667 ms/frame here draw function void text::draw(const char* text, float x, float y, float sx, float sy) { const char *p; ft_glyphslot g = face->glyph; gluint tex; glactivetexture(gl_texture0); glgentextures(1, &tex); glbindtexture(gl_texture_2d, tex); gluniform1i(uniform_tex, 0); glpixelstorei(gl_unpack_alignment, 1); gltexparameteri(gl_texture_2d, gl_texture_wrap_s, gl_clamp_to_edge); gltexparameteri(gl_texture_2d, gl_texture_wrap_t, gl_clamp_to_edge); gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_linear); gltexparameteri(gl_texture_2d, gl_texture_mag_filter, gl_linear); glenablevertexattribar

regex - re.findall in Python 3 -

i wanted use function re.findall(), searches through webpage pattern: from urllib.request import request, urlopen import re url = request('http://www.cmegroup.com/trading/products/#sortfield=oi&sortasc=false&venues=3&page=1&cleared=1&group=1', headers={'user-agent': 'mozilla/20.0.1'}) webpage = urlopen(url).read() findrows = re.compile('<td class="cmetablecenter">(.*)</td>') row_array = re.findall(findrows, webpage) #error here i error: typeerror: can't use string pattern on bytes-like object urllib.request.urlopen returns bytes object, not (unicode) string. should decode before trying match anything. example, if know page in utf-8: webpage = urlopen(url).read().decode('utf8') better http libraries automatically you, determining right encoding isn't trivial or possible, python's standard library doesn't. another option use bytes regex instead: findrows = re

java - I could not understand this that why to use flush() method of a PrintWriter class? -

this question has answer here: how use flush() printwriter 2 answers why code here using flush() method of printwriter class after getting message messagebox field....? public void connecttosocket() { try { socket socket = new socket("localhost", 80); printwriter writer = new printwriter(socket.getoutputstream); system.out.println("connected successfully"); } catch(ioexception ex) { ex.printstacktrace(); } } public class sendmessagelistener implements actionlistener { try { writer.println(messagebox.gettext()); writer.flush(); } catch(ioexception ex) { ex.printstacktrace(); } } the default constructor printwriter not autoflushes contents. means uses internal buffer since writing operations expensive. if want write buffer st

How to flip a VRML file (.wrl), or flip the VR model in Matlab -

i have complex vrml model of prosthetic right hand in .wrl file (3 megabytes) manipulating (animating according commands) in matlab. i'd make mirror image ( horizontal flip ) of file (to left hand). not mind whether use free program process file (which imagine should involve mirroring horizontal co-ordinates) or if there matlab command can flip vr model, haven't been able find solution. there's nothing else in "world" within file can flipped. there named transforms in file , need them keep names, because joints animated, it's not problem if have change sign of rotations things moving in correct mirrored direction. i'm looking simple , free solution. thanks! i wouldn't suggest manually. easiest solution export model .max or other file can open 3d modeling program (3dsmax, deepexploration, maya, etc.) once have new file, can open of these programs, think it's easier job. can using interface dragging or clicking buttons, not manu

Android soft keyboard pops up and hides automatically -

i have strange issue soft keyboard keeps popping , hiding out in application. it happens on tablets, on phone works no problem, when running app in tablet problem happens. tried in real devices, same problem occurs. i searched lot other posts have same problem, couldn't find else have same problem. here video of problem: http://youtu.be/b9jjqzgxaio here manifest code fragment: <activity android:name="com.mapsaurus.panesexample.createassignment" android:configchanges="orientation|screensize" android:label="@string/title_activity_create_assignment" > </activity> i tried , without android:configchanges="orientation|screensize" , , without android:windowsoftinputmode="statevisible" without luck. i'm using android-paneslibrary , edittext field inside sherlockfragment not activity, when in normal activity, works fine. i hope have solution this. thanks.. after wrote

c# - code first get values from foreign key constraint -

i've started sample project code first , null value entity has foreign key constraint. my model: public class customeritem { [key] public int id { get; set; } public int name{get;set;} public virtual ienumerable<orderitem> order { get; set; } } public class orderitem { [key] public int id { get; set; } [foreignkey("customeritem")] public int customerid { get; set; } public virtual customeritem customeritem { get; set; } } dataaccess linq query values: public ienumerable<customeritem> getordersfromcustomeritem(int id) { return (from c in this.dax.customer c.id.compareto(id) == 0 select c).asenumerable().tolist(); } this query return null orders think there's mistake in query. how can wire entity foreign key table? thanks updated query customers (and orders) this: public ienumerable<customeritem> getallcustomers() { return (from c in this.dax.customer

regex - php - split by unknown regular expression -

i need split string seperators known me , unknown. example know want split string "\n" , "," , "." 1 sperator can user defined: example can ";" or "hello" or pretty anything. i tried this: "[\n|,|.|".$exp."]" ...but didnt work expected. understand | means or. reg exp should split "\n" or "," or "." or "hello". think because if try [hello] splits every letter, not whole word. thats strange because if try [\n] splits "\n" - not "\" or "n". can please explain me? :) when place bunch of characters in character class, in [hello] , defines token matches 1 character either h, e, l or o. also, | has no meaning inside of character class - it's matched normal character. the correct solution isn't use character class - meant use normal brackets: (\n|,|\.|".$exp.") by way - make sure escape regex metacharacters in

PHP newbie, what isn't correct here? -

i don't know question should asking. i'm looking "how should php documents start" , similar i'm not turning helpful. have following file set in mamp "htdocs" folder should allow me access through localhost. however, whenever load in chrome server error http 500. if delete whole thing no error. if load first php block still error. questions need asking? edit clarity. without debug block, code doesn't load. debug block code doesn't load edit: updating code fixes <?php ini_set('display_errors', 'on'); error_reporting(e_all | e_strict); ?> <?php if ($_server["request_method"] == "post") { $text = $_post["email_text"]; include "etext.php"; //run etext $output_file_path = "#"; //set running etext header("location: index.php?status=submitted"); exit; } ?> <h1>etext email converter</h1> <?php if (isset($_get[&quo

Difficulty with rapidjson .11 GetInt(), always returns 0 -

here json form: {"simplechannels":{"item":[{"channelid":4248,"majorchannelnumber":22,"minorchannelnumber":0,"channeltype":"sll","simpleschedules":[],"channelkey":"4248_1343210400000","shortname":"kwhy","longname":"a3 los angeles 22 kwhy ind","networkaffiliation":["independent"],"logoid":0,"authcode":"fs","engchlflag":false,"hasmirror":true,"pgsource":"active","hdchlflag":true,"adultchlflag":false,"vodproviderid":0,"blackout":false,"livestreaming":"n"}]}} here code attempts parse , extract values: json std::string containing above: m_guideslice.parse<0>(json.c_str()); rapidjson::value& simplechannels = m_guideslice["simplechannels"]; if (simplechannels.isobj