Posts

Showing posts from August, 2011

php - Secure streaming link -

i have problem secure , protect video link direct downloads. i trying make link http://server1.site.com/videos/123/456/789.mp4?key=0457043013fbd9ebae8ae3 where in key= can add user, session, id, or else, , in way protect direct download without proper key. http://server1.site.com/videos/123/456/789.mp4 how make work .htaccess ? on apache web server , don't know other way make this. this example : stream link , can downloaded http://pdl.vimeocdn.com/42891/829/162390948.mp4?aktimeoffset=0&aksessionid=3b9dcceb7a14b3436e0a7bfa0b40126b&token=1369110913_9c3017a9a1bbb77b1ca36c7b7c1eb70f but can't download http://pdl.vimeocdn.com/42891/829/162390948.mp4

asp.net - Unable to locate Global asax file in web app VS2012 -

i'm building web application in visual studio 2012. meet error such webforms unobtrusivevalidationmode requires scriptresourcemapping 'jquery'. please add scriptresourcemapping named jquery(case-sensitive). therefore after googling, says need edit parts in global asax file. however, i'm not able locate global asax file when create web app. i'm able find when create website. the global.asax file not required. here info microsoft. if right click on project , go add->new item , open wizard, can select web in left box , global application class in right box automatically add global.asax file in name box , can create easily. hope helps.

java - How to set the camera within a cube? -

Image
i have cube has different color each side-lock - public void display(glautodrawable drawable) { final gl gl = drawable.getgl(); gl.glclear(gl.gl_color_buffer_bit | gl.gl_depth_buffer_bit); ///// set camera ///// setcamera(gl, glu, 100); // /////// cube - start /////////// // cube // ----- render color cube ----- gl.glloadidentity(); // reset current model-view matrix gl.gltranslatef(0f, 0.0f, -7.0f); // translate right , // screen gl.glrotatef(anglecube, 1.0f, 1.0f, 1.0f); // rotate x, y , // z-axes gl.glbegin(gl.gl_quads); // of color cube // top-face gl.glcolor3f(0.0f, 1.0f, 0.0f); // green gl.glvertex3f(1.0f, 1.0f, -1.0f); gl.glvertex3f(-1.0f, 1.0f, -1.0f); gl.glvertex3f(-1.0f, 1.0f, 1.0f); gl.glvertex3f(1.0f, 1.0f, 1.0f); ...

javascript - multiple async mongo request in nodejs -

how write multiple queries in row? like a space.findone({ _id: id }, function(err, space) { user.findone({ user_id: userid }, function(err, user) { res.json({ space: space, user: user}); }); }); does not more requests , logic how done correctly? i heard promise, not know. thanks when i've had similar issue, i've used async library. async.parallel([ function(callback){ space.findone({ _id: id }, callback); }, function(callback){ user.findone({ user_id: userid },callback); } ], function(err, results){ res.json({space:results[0],user:results[1]}); }); you can use async.series if want sequential execution.

ruby on rails - ERROR -- : reaped #<Process::Status: pid 4335 exit 1> worker=0 -

i trying since 2 days deploy on vps (ubuntu 12.04 server (64 bits)) using : ruby (1.9.3-rc1), rails, capistrano, nginx , unicorn. i follow railscast tutorial ryan bates showing how deploy on vps scratch. actualy cap deploy:cold command seems work fine (as others) when try go on url fall on "we're sorry went wront" => default error page rails. in production logs : migrating createquestionanswers (20130317152603) migrating createregions (20130502212531) migrating addregionidtosection (20130502212557) migrating createannonceimages (20130510130906) migrating addattachmentimagetoannonceimages (20130510130925) migrating createformations (20130510195503) migrating createinscriptions (20130510195627) migrating addattachmentimagetoformations (20130511182928) migrating addparamstoinscription (20130514231201) migrating addpaypalidtoinscription (20130514234243) (0.3ms) select "schema_migrations"."version" "schema_migrations" connectin...

data binding - databinding in WPF using a base class for field creation in various forms -

i had application working fields being created in class each field generated separately in usual fashion public class requestprofileobject : inotifypropertychanged { public event propertychangedeventhandler propertychanged; private string strpassword; public string pwd { { return strpassword; } set { strpassword = value; // call onpropertychanged whenever property updated onpropertychanged("pwd"); } } //plus other code load data field , onpropertychanged //method } then saw needed able keep track of changes , came mechanism , other features needed. needless lot of repeated code caused me have bright idea of making class these object. public class etlbasefield : inotifypropertychanged { public event propertychangedeventhandler propertychanged; private string strfieldprime; private string strfield; private string strfieldname; ...

Prolog zodiacal and leap year -

i'm trying tell me zodiacal sign , if year leap year of in prolog and looks great it's shows me error when try cosnult here code /* 7. horóscopo horoscopo(signo,diaini,mesini,diafin,mesfin) <- son del signo signo los nacidos entre el dia ini/mesini y el diafin/mesfin */ horoscopo(aries,21,3,21,4). horoscopo(tauro,21,4,21,5). horoscopo(geminis,21,5,21,6). horoscopo(cancer,21,6,21,7). horoscopo(leo,21,7,21,8). horoscopo(virgo,21,8,21,9). horoscopo(libra,21,9,21,10). horoscopo(escorpio,21,10,21,11). horoscopo(sagitario,21,11,21,12). horoscopo(capricornio,21,12,21,1). horoscopo(acuario,21,1,21,2). horoscopo(piscis,21,2,21,3). mes(1,31,enero). mes(2,28,febrero). mes(3,31,marzo). mes(4,30,abril). mes(5,31,mayo). mes(6,30,junio). mes(7,31,julio). mes(8,31,agosto). mes(9,30,septiembre). mes(10,31,octubre). mes(11,30,noviembre). mes(12,31,diciembre). signo(dia,mes,signo) :-horoscopo(signo,d1,m1,d2,m2),((mes=m1,dia>=d1,mes(m1,d,_),dia=<d);(mes=m2,dia=<d2,d...

update mysql value based on previous date value -

i have mysql table following structure id name_id class_id currency date value change 1 bill 0 04-01-2013 10.00 0 5 bill 0 04-02-2013 9.90 0 12 fred 0 04-01-2013 8.00 0 13 fred b 1 04-02-2013 8.50 0 22 fred b 1 04-03-2013 8.51 0 i want update change column based on difference between day's value , previous date value when name_id , class_id , , currency equal . . . in small excerpt row 2 updated -0.10 and row 5 0.01 . there 400,000 rows have auto-incremented id ids not in kind of order. there weekend , holidays dates missing, not sequential dates. i seem able show change query this select pd.name_id, pd.class_id, pd.currency, pd.date, pd.value, round(pd.nav - (select nav price_data x x.date < pd.date , x.name_id = pd.name_id ...

php - Count SQL Syntax COUNT (value) multiple columns -

hello im trying learn count in sql, cant count how many times value in specific column my database structure this. (table : natural) id | 1 | 2 | 3 | 1 | 34 | 45 | 80 | 2 | 41 | 34 | 7 | 3 | 7 | 18 | 22 | 4 | 8 | 7 | 45 | im trying this $result=mysql_query("select count(one) total natural one=7")or die("error: ".mysql_error()); $data=mysql_fetch_assoc($result); echo $data['total']; but 1 column in count cant result.. what need count how many times "value" (for example 7) in columns like in example value 7 = 3 total (multiple columns) how can make sql that. edit: trying (where syntax problem?) $result=mysql_query("select count(distinct id) totalcount tblname 7 in (one, two, three)")or die("error: ".mysql_error()); $data=mysql_fetch_assoc($result); echo $data['totalcount']; i suck, answers, think problems mysql_query () cause got syntax problem, answers , me. ...

Why is window.kendo undefined in jsfiddle -

h there, i have created jsfiddle. have linked following external resources: http://getfirebug.com/firebug-lite-debug.js http://cdn.kendostatic.com/2013.1.319/js/kendo.all.min.js http://cdn.kendostatic.com/2013.1.319/styles/kendo.common.min.css http://cdn.kendostatic.com/2013.1.319/styles/kendo.default.min.css http://cdn.kendostatic.com/2013.1.319/js/jquery.min.js and have following markup: <div id="test">test</div> and have following javascript: alert($("#test").html()); alert(window.kendo.guid()); the first alert returns 'test' expected. second alert fails. i have tested kendo js external resources in address bar of browser , both load. why window.kendo undefined? regards, scott apparently order of external resources. when changed them following order, worked fine: http://cdn.kendostatic.com/2013.1.319/js/jquery.min.js http://cdn.kendostatic.com/2013.1.319/js/kendo.all.min.js http://cdn.kendostatic.com/2013.1....

ruby on rails - Rendering different partials depending on user window size -

i test if user's browser window.width >= 800px if render partial otherwise if window.width >= 800px. i have little experience, please explain options on implementation: expecting either javascript method on page or jquery. i have tried http://scottwb.com/blog/2012/02/23/a-better-way-to-add-mobile-pages-to-a-rails-site/ but 1. doesn't work me. 2. if did expect work based on device being used, not pixel count. thank in advance! a request won't contain data screen size, in common sense sever has no way know screen width , response serve, pinnym mentioned in comment. a general practice use user agent detect mobile device server. user agent part of request. it's not 100% accurate, it's still depend on cases. however, there still solutions question - serve page based on screen size. the workaround use javascript detect screen size @ first, use js drop cookie. server able read cookie , decide template render. the basic repo here: http...

deployment - development and debugging base ground -

i new here , want put me on right direction. i developing website using apache , php on windows server scratch. no frameworks except jquery. we released couple of weeks ago , running issue of debugging , releasing. the way i'm debugging , releasing, instant page contact.php, create copy of current page under different name (contact_test.php) , debug it. once i'm done, i'd delete contact.php , replace contact_test.php , rename contact.php i know it's immature way of doing that's why i'm asking. i heard php-deployer way not familiar or how works. suggestions? opinions? cheers there nothing wrong approach. app grows more sophisticated , requires updates many source files across project revisions might find helpful operate separate dev server own branch of sources. enables other (qa test partner, end user/client) approve changes prior moving production.

php - replace string but not a specific word that contains that string -

suppose have string $string = 'this gal_s, not 1_s not 2_s not 3_s'; $find = '_s'; $replace = ''; i woul return "this gal_s, not 1 not 2 not 3" so word gal_s not affected is possible? you can use preg_replace negative lookbehind this: $repl = preg_replace('/(?<!\bgal)_s/', '', $str); live demo: http://ideone.com/getsv3

amazon web services - How to get response from SES when using C# SMTP API -

the .net smtpclient's send method returns void. throws 2 exceptions, smtpexception , failuretosendtorecipientsexception (or that). when using ses, successful email delivery ses sends 200 ok message message id. message id needs tracked. how do using c# smtp api? edit: smtp protocol mentions various response codes sent smtp server. looking smtp library exposes "final" response code caller. aware of ses http api. not looking use moment. have tried amazon ses (simple email service) c# wrapper ? it has sendemail method returns class messageid: public amazonsentemailresult sendemail(string toemail, string senderemailaddress, string replytoemailaddress, string subject, string body) { list<string> toaddresslist = new list<string>(); toaddresslist.add(toemail); return sendemail(this.awsaccesskey, this.awssecretkey, toaddresslist, new list<string>(), new list<string>(), senderemailaddress, replytoemailaddress, s...

Azure mobile facebook authentication with iPhone HTML5 in app (full screen) mode -

i have html5 application uses azure mobile services authentication login (straight example code...provided below). works fine in desktop browsers , iphone 5 in safari. app / full screen mode, nothing (doesn't ask permission show popup window in safari , no popup windows shows up) , can wait forever , nothing happens. if invoke second time, gives error saying "error: unexpected failure"...perhaps because 1st attempt still running? help/insight appreciated. client.login ("facebook").done(function (results) { alert("you logged in as: " + results.userid); }, function (err) { alert("error: " + err); }); edited update more info , 2 potential ideas* i did more research , found site uses approach overcomes problem , solves 2 other side effects current azure mobile approach authentication. think azure mobile team might looking similar because there hints of other authentication options in code (although difficult read , sure ...

Junit Test Case Builder (JUB) plug-in in Eclipse for Junit testcases automation -

i using jub (junit testcase builder) plugin in eclipse. have downloaded jub plugin , installed according instructions given in following website, http://jub.sourceforge.net/ while selecting option "build junit test case", getting information "the chosen operation not available". anyone facing same problem? kindly reply. if there anyother plugin junit test cases automation useful. i not sure jub plugin eclipse, suggest codepro analytix eclipse automating test cases since easy install , use. you can find details of codepro analytix here codepro analytix direct plugin available in eclipse market place eclipse versions 3.6 or below. can installed , used eclipse versions 3.7 or more following below steps. aware of problems may occur due version conflicts. installing codepro in eclipse: download codepro v7.1.0 here in eclipse choose --> install new software... in install window appears click on add button. in add repository dialog box ap...

postgresql - Postgres Query with Regex -

i'm trying create regex find (and replace) parts of strings in pg db. i'm using psql 9.0.4 i've tested regex outside of pg , works perfectly. however, isn't playing pg. if can me understand i'm doing wrong me appreciated. regex: {php}.*\n.*\n.*'mister_xx']\)\);.*\n} \n{\/php} postgres query: select count(*) (select * "table" "column" ~ '{php}.*\n.*\n.*'mister_xx']\)\);.*\n} \n{\/php}') x; postgres response: warning: nonstandard use of escape in string literal line 1: ...m (select * "table" "column" ~ '{php}.*\n... ^ hint: use escape string syntax escapes, e.g., e'\r\n'. error: syntax error @ or near "mister_xx" line 1: ..."table" "column" ~ '{php}.*\n.*\n.*'mister_x... in sql, quotes delimited 2 quotes, example: 'child''s play' applying regex ma...

c# - Is there a function to compare a string to a larger string? -

this question has answer here: case insensitive 'contains(string)' 21 answers a better way explain question list names of names contain given string. example, if given string "john,", system display names of every person name contains "john", such "john smith", "elton johns", , "johnny h". i couldn't explain in question , trying find i'm looking on google when can't phrase right difficult if search case-sensitive, can use contains : var name = "john smith"; if(name.contains("john")) { // name contains john } or, all names contain john : var names = new string[] {"john smith", "bob smith", "frank"}; var results = names.where(n => n.contains("john")); if want ignore case, can convert both strings lowercase: var ...

iphone - iOS - Check if file exists Dropbox Sync API iOS SDK -

i'm new ios development, , working on app support dropbox sync text files. having followed tutorial on dropbox site i'm not able check if file exist. as implemented: nsstring *dropboxfileextension; switch ([[nsuserdefaults standarduserdefaults] integerforkey:kfileextension]) { case txt: dropboxfileextension = [nsstring stringwithformat:@"%@.txt", titlestring]; break; case md: dropboxfileextension = [nsstring stringwithformat:@"%@.md", titlestring]; break; case markdown: dropboxfileextension = [nsstring stringwithformat:@"%@.markdown", titlestring]; break; default: break; } dbpath *newpath = [[dbpath root] childpath:[nsstring stringwithformat:@"%@", dropboxfileextension]]; dbfile *file = [[dbfilesystem sharedfilesystem] createfile:newpath error:nil]; [file writestring:self.note.contents error:nil]; if update contents, throws error file exists. so how can...

html - CSS of a slide in swipe view -

i working in phone gap using java script,html , css. have implemented swipeview using this . my doubt how should css be.the css implemented follows. .swiper-threshold { width:100%; height:350px; margin-top:40px; text-align:left; line-height:20px; font-size: 15px; text-align:justify; text-justify:inter-word; } .swiper-threshold .swiper-slide{ width:auto; height:350px; margin-top:2%; margin-left:0; padding-right:0%; text-align:left; line-height:20px; font-size: 15px; text-align:justify; text-justify:inter-word; } the sliding movement left right.when reaches last slide.the movement reverses. when,i change margin-left:0; 0 5...as , when slide left space gets on adding last slide seen half of screen. but,when give margin-left:0; stuck left margin. html coding: <div id="swipe_body"> <div class="swiper-container swiper-threshold"> <div class="swiper-wrapper" id="swiper-wrapper"> </div> ...

r - Generating random numbers from various distributions in CUDA -

i playing around doing mcmc on gpu, , need implementations various samplers, written cuda. most of posts i've seen on stackoverflow relate uniform, binomial, , normal sampling. there libraries allow me simplicity , variety of d-p-q-r functions in r (see this page)? i able sample gamma, normal, binomial, , inverse distributions used in bayesian problems (inverse chi square, inverse gamma), , prefer not have write own using inverse probability transforms , acceptance-rejection sampling. for gamma distribution, use @ moment. gsl function modified work curand. __device__ double ran_gamma (curandstate localstate, const double a, const double b){ /* assume > 0 */ if (a < 1){ double u = curand_uniform_double(&localstate); return ran_gamma (localstate, 1.0 + a, b) * pow (u, 1.0 / a); } { double x, v, u; double d = - 1.0 / 3.0; double c = (1.0 / 3.0) / sqrt (d); while (1){ do{ x = curand_normal_double(&localsta...

python - set auto increment initial value for id in django model -

i have model 1 field. name. class city(models.model): <br> name = models.charfield(max_length=30) django sets id end id , description field in sql. but id field increment 1. want start 1000 , increment one. is there way in django? you use initial data give models ids 1000. think if first models pk 1000 django continue 1001. or create attribute called custom_id 1000+id. way have additional field in db work.

c++ - Initializing a vector from arrays going wrong -

i'm creating vector<vector<char>> char arrays follows: typedef vector<vector<char>> board; ... char row0[] = {'x', '-', '-', '-', '-', '-', '-', '-', '-', 'x'}; char row1[] = {'-', 'x', '-', '-', '-', '-', '-', '-', 'x', '-'}; char row2[] = {'-', '-', 'x', '-', '-', '-', '-', 'x', '-', '-'}; char row3[] = {'-', '-', '-', 'x', '-', '-', 'x', '-', '-', '-'}; char row4[] = {'-', '-', '-', '-', 'x', 'x', '-', '-', '-', '-'}; char row5[] = {'-', '-', '-', '-', 'x', 'x', '-', '-', '-', '-...

c++ - Arranging words in alphabetical order -

this implementation , have txt file animals randomly assign. want order them , insert list. void sortedlist::insert(std::string x){ int insertpoint=0; if(top==n){ n = 2 * n; string* temp = arr; arr = new string[n]; (int = 0; < top; i++){ arr[i] = temp[i]; } delete[] temp; } arr[top]=x; linearordering(); top++; } and void sortedlist::linearordering(){ for(int i=0; < top ; i++){ if (arr[i] > arr[ + 1]) { swap (arr[i], arr[i+1]); } } } this result aardvark baboon cougar gorilla lion mouse ocelot gerbil orangutan hamster panther elephant rat rhinoceros tiger hippopotamus zebra what wrong code make partially ordered. it looks you're trying bubble-sort list. have loop more once make work. this answer assumes you're doing educational purposes. otherwise, stilescrisis suggests, use std::sort() , might prefer std::vector<std::string...

networking - Ubuntu Server 12.10 3g modem connection established but not used -

our server has lan (dhcp) connection internal network , 3g (via usb dongle) internet. internet access should not exposed internal network , vice versa. to able use 3g modem followed 2 manuals: https://askubuntu.com/questions/143989/3g-usb-modem-not-working-in-12-04 http://forums.gentoo.org/viewtopic-t-766982.html now when wvdial provider_name connection established. interface , has ip, dns etc setup according ifconfig however whenever try ping public internet server still trying use lan network , not ppp interface. how can solve it? ps: i've tried following - put auto ppp0 iface ppp0 inet wvdial /etc/network/interfaces before auto eth0 , on start brings ppp0 interface up, unplug cable lan , restart, after works fine, if restart server lan cable plugged in, still using eth0 gateway default! the output ip route show : default via 192.168.1.1 dev p2p1 10.64.64.64 dev ppp0 proto kernel scope link src 172.30.50.98 192.168.1.0/24 dev p2p1 proto kernel sc...

what is the difference between getelementsbytagname and getelementsbyname in javascript -

i came across these 2 methods dom elements retrieval in douglas crockford presentation couldn't understand difference between these two. document.getelementsbytagname() document.getelementsbyname() can please explain me. the link video http://www.youtube.com/watch?v=fv9qt9joc0m suppose have html : <input name="test" class="cssclassname"> you'd got with document.getelementsbytagname('input') or document.getelementsbyname('test') or document.getelementsbyclassname('cssclassname') also, can call getelementsbytagname on elements other document. example following allowed, document.getelementsbyid('foo').getelementsbytagname('bar') but getelementsbyname can called on document . notes : javascript case sensitive, can't write functions did in question those functions don't return element live nodelist , you'll have iterate on result or take first 1 if you're...

Do I have to open couchbase port range 21100 to 21199? -

i'm using couchbase lastest version. must open port of range 21100 21199? have problem open port 1 of them?(ex, 21100 port) please me. yes have open these ports. used erlang inter-nodes communication.

android - downloaded non-english html file not readable in webview -

save (malayalam) string content code string = "<html><head><style>" + "@font-face { font-family: manorama;src: url(file:///android_asset/manorama.ttf); }" + "h1 { color: #222;font-size: 26px;margin-top: 32px; }" + "</style></head><body><h1>" + "<font face=\"manorama\">Øíxàw ¥çÄÞùßxßÏßw 190 æd¿ÏßÈß</font><!--3546062932-->" + "</p><body></html>"; fileoutputstream ostream = null; try { ostream = openfileoutput("0.html", context.mode_private); ostream.write(a.getbytes("utf-32")); ostream.close(); } catch (exception e) { } it working perfectly but when same operation after downloading server doesn't work (characters non readable in webview), find code below, httpclient client = new defaulthttpclient...

iphone - error on AdMob integration -

i have added addmob sdk in project , added framework needed. m getting below error storekit framework have added in project still getting error.. ld: warning: directory not found option '- l/users/company/downloads/projectname/googleadmobadssdkios-6.4.2/add- ons/googleanalyticsios_2.0beta4/library' ld: warning: directory not found option '-l/users/company/downloads/projectname/googleadmobadssdkios-6.4.2' ld: warning: ignoring file /users/company/downloads/storekit.framework/storekit, missing required architecture i386 in file /users/company/downloads/storekit.framework/storekit (2 slices) undefined symbols architecture i386: "_objc_class_$_skstoreproductviewcontroller", referenced from: objc-class-ref in libgoogleadmobads.a(gadopener.o) "_skstoreproductparameteritunesitemidentifier", referenced from: -[gadopener openinappstore:fallbackurlstring:] in libgoogleadmobads.a(gadopener.o) ld: symbol(s) not found architecture i386 clang: err...

security - Java SSL Safety -

i have client-server model uses ssl on every connection. have used java , common libraries program this. have 2 questions regarding ssl safety: 1) is considered safe send password in plaintext client server? server uses bcrypt hash password , store it. have considered sending unsalted hash of password or nounced hash of password, more safe sending password in plaintext? doubt it. don't think sending password salted hash viable option, salt need stored somewhere in client or send on network, , don't think make inherently more safe sending password plaintext. due ssl nobody else should able read anyway, right? 2) does encrypted data on ssl gets encrypted different string, , if so, can use earlier encryption of string same result later? clarify: if encrypt data now, , few seconds later, procide same cipher text? if use cipher text encrypting "test", can send same cipher text on later moment let server believe client legitly sent "test"? under c...

ruby - zsh: Heroku toolbelt not found anymore -

i switched zsh, pretty happy that. except heroku toolbelt doesn't work anymore ... here have when type heroku -v : /usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': not find heroku (>= 0) amongst [actionmailer-3.2.13, actionpack-3.2.13, activemodel-3.2.13, activerecord-3.2.13, activeresource-3.2.13, activesupport-3.2.13, arel-3.0.2, bcrypt-ruby-3.0.1, bootstrap-sass-2.3.1.0, builder-3.0.4, bundler-1.3.5, climate_control-0.0.3, cocaine-0.5.1, coffee-rails-3.2.2, coffee-script-2.2.0, coffee-script-source-1.6.2, daemons-1.1.9, devise-2.2.3, erubis-2.7.0, eventmachine-1.0.3, execjs-1.4.0, faraday-0.8.7, haml-3.1.4, hashie-1.2.0, hike-1.2.2, httpauth-0.2.0, i18n-0.6.1, journey-1.0.4, jquery-rails-2.2.1, json-1.7.7, jwt-0.1.8, mail-2.5.3, mime-types-1.23, mime-types-1.22, multi_json-1.7.3, multi_json-1.7.2, multipart-post-1.2.0, oauth2-0.8.1, omniauth-1.1.3, omniauth-facebook-1.4.1, omniauth-oauth2-1.1.1, orm_adapter-0.4.0, paperclip-3.4.1, pg-0.15.1, polyglot...

c# - Task.Run apparently locks UI when nested too deep -

i have wpf application needs parse bunch of large xml files (around 40mb) containing products , save information products books. progress reporting, have datagrid displays filename, status ("waiting", "parsing", "completed", sort of thing), number of products found, number of parsed products, , number of books found, this: <datagrid grid.columnspan="2" grid.row="1" itemssource="{binding onixfiles}" autogeneratecolumns="false" canuseraddrows="false" canuserdeleterows="false" canuserreordercolumns="false" canuserresizecolumns="false" canuserresizerows="false" canusersortcolumns="false"> <datagrid.columns> <datagridtextcolumn header="bestand" isreadonly="true" binding="{binding filename}" sortmemberp...

php - Memcache that is not TCP-based? -

i implemented memcache , memcached php implementation. none of them fast enough, since based on tcp. nice if there solution stored data across sessions, directly in memory. is possible? haven't been able find solution allows me so. edit "not fast enough" in trying store 130 rows, 100 times. each rowset has different data defined key. defining them fast. limitation might serialization, since data not large byte-wise. i hoping in-memory solution supports storing object's bytes directly in memory rid of need serialization. i tried ig_binary serialization mode memcached . use apc, alternative php cache. works on same host, indeed doesn't use network traffic. http://php.net/manual/en/book.apc.php

android - Resize the bitmap -

im project capturing image camera app , displaying image in listview using following code . mysimplecursoradapter: public class mysimplecursoradapter extends simplecursoradapter { public mysimplecursoradapter(context context, int layout, cursor c, string[] from, int[] to) { super(context, layout, c, from, to); } @override public void setviewimage(imageview image_v, string id) { string path = id; bitmap b = bitmapfactory.decodefile(path); image_v.setimagebitmap(resizedbitmap); } } list.java string[] = new string[]{dbmanager.babyname, dbmanager.baby_image}; int[] = new int[] {/*r.id.list_id,*/ r.id.drname12,r.id.imageview1};//,r.id.list_date};{ mysimplecursoradapter adapter = new mysimplecursoradapter(this, r.layout.rowlayout, c1, from, to); list.setadapter(adapter); every things working fine till point when try resize bitmap using piece of code bitmap resi...

c - what's the difference between the two code block? -

in program , use basename function partition. first , write if sentence this: if (!strncmp(buf, basename("/dev/mmcblk0p3"), strlen(basename("/dev/mmcblk0p3"))) { ret = 1; } else { ret = 0; } buf point string "mmcblk0p3" , ret = 0, using gdb, found basename("/dev/mmcblk0p3") returned weird string, when changed program this: char *p = null; p = basename("/dev/mmcblk0p3"); if (!strncmp(buf, p, strlen(p)) { ret = 1; } else { ret = 0; } the ret 1, program runs normal. difference? basename cannot used ? compiling environment armel7v/gcc. one consequence of using non-reentrant function basename returns string subsequent invocations invalidate prior results. need make copy of return value before making second call, or stop using old value after second call has returned. because basename has 1 internal buffer store result, assuming not modify parameter ( looks case program, because not crash on str...

android - Run code before onCreateView -

i want run code in fragment before oncreateview method called. want show alertdialog , want call oncreateview first time if user clicks on positive button. possible? no not. can show dialog , commit transaction fragment on user click.

javascript - Comparing knockout observable array and removing any object with match id from the array -

1st observable array: data = [{id:1 , name:'abc'},{id:2 ,name:'xyz'},{id:3 , name:'rst'}] another array: dataprovider = [{id:3 , name:'pqr'} , {id:4 , name:'hjk'}] now can compare data array data provider , id = 3 should replace previous object , id = 4 push object data array. therefore new data array this data = [{id:1 , name:'abc'},{id:2 ,name:'xyz'} ,{id:3 , name:'pqr'} , {id:4 , name:'hjk'}] an alternative using $.each use knockout's own utility function ko.utils.arrayfilter achieve this. cached matchable ids in object don't have loop on entire dataprovider each data entry. var matches = {}, = 0, len = dataprovider.length, filtereddata = []; // transform data prevent looping on array n times n = data.length (; < len; i++) { matches[dataprovider[i].id] = dataprovider[i]; } filtereddata = ko.utils.arrayfilter(self.data(), function(item) { return !(i...

java - Spring data version annotation not incrementing when used on a mongo collection -

i using spring data mongodb store binary data such images etc want maintain version field append url cheat browser caching images. see document base class below: import org.springframework.data.annotation.id; import org.springframework.data.annotation.version; import org.springframework.data.mongodb.core.index.indexed; public abstract class basedocument { @id @indexed(unique=true) protected long id; protected byte[] data; protected string mimetype; protected string filename; protected string extension; @version private long version; i have repository wrapping mongooperations saving documents. import org.springframework.beans.factory.annotation.autowired; import org.springframework.stereotype.repository; @repository public class documentrepository implements idocumentrepository { @autowired private mongooperations mongotemplate; @override public <d extends basedocument> void savedocument(d document) { mo...

objective c - Fail to jump from a portrait view to a landscape view -

everyone. i've got 2 views. first view supports landscape orientation , second view supports orientations. however, when second view portrait , button pressed, jumps first 1 portrait, meant landscape. i've added following 2 method in first viewcontroller. - (bool)shouldautorotate { return yes; } -(nsuinteger)supportedinterfaceorientations { return uiinterfaceorientationmasklandscapeleft | uiinterfaceorientationmasklandscaperight; } i wonder if me, since issue had puzzled me long. in forward!! i not sure whether got u correctly or not. upto got have 2 viewcontrollers, first viewcontroller supports landscape while 2nd viewcontroller supports orientations. r having problem in maintaining this. check whether have implemented in code, if u still find problem, revert , if solves kindly accept answer , vote ;) :- 1) first viewcontroller should have :- // ios 6 -(bool)shouldautorotate{ return yes; } -(nsuinteger)supportedinterfaceorientations{ ...

Delphi xe3 vcl to firemonkey array issue -

when converting vcl firemonkey in delphi, have following issue: in vcl have following array: tcarray=array[1..$04000000] of tcoordinate; - works fine. however, declaring same array in firemonkey exception stack overflow @ 0x00.. solution far minimize array [1..40000]. why this? solution? the vcl code follow unit ptypes; interface uses windows,vcl.graphics,vcl.imaging.jpeg,vcl.imaging.gifimg,system.types; type tcoordinate=packed record x,y:double; end; tcarray=array[1..$04000000] of tcoordinate; tpoly=packed record n:longint; c:tcarray; end; it called this: procedure tform12.button2click(sender: tobject); var poly:tpoly; begin poly begin c[1].x:=100; c[1].y:=100; c[2].x:=400; c[2].y:=100; c[3].x:=400; c[3].y:=400; c[4].x:=250; c[4].y:=550; c[5].x:=100; c[5].y:=400; n:=5; end; this works fine in vcl in fm breaks following error: "project fmtest.exe raised exception class $c00000fd message 'stack overflow @ 0x00af69e7...

objective c - 'NSInternalInconsistencyException' in iphone4 -

i getting following crash randomly, please can 1 suggest me going wrong here : - last exception backtrace: 0 corefoundation 0x31b2129e __exceptionpreprocess + 158 1 0x3984997a + 964991354 2 corefoundation 0x31b21158 +[nsexception raise:format:arguments:] + 96 3 foundation 0x323f6ab2 -[nsassertionhandler handlefailureinmethod:object:file:linenumber:description:] + 86 4 uikit 0x3395db7e -[uitableview(_uitableviewprivate) _endcellanimationswithcontext:] + 7690 5 uikit 0x33af6764 -[uitableview reloadsections:withrowanimation:] + 36 6 zoment 0x00212e50 0xd4000 + 1306192 7 zoment 0x00150428 0xd4000 + 508968 8 0x39c6111a + 969281818 9 0x39c604b2 + 969278642 10 0x39c651b8 ...

java - Return path doesn't get set using mail.smtp.from -

i having problems setting return path yahoo emails i'm sending. here's i'm using: properties props = new properties(); props.put("mail.transport.protocol", "smtps"); props.put("mail.smtps.auth", "true"); props.put("mail.host", host); props.put("mail.port", port); props.put("mail.user", username); props.put("mail.password", password); props.put("mail.smtp.from", bounceaddress); i'm sending mimemessage using transport.sendmessage method. still, after sending few, in full-header yahoo mails return path same sender email. idea might problem? thanks you're using "smtps" protocol, setting property "smtp" protocol. set "mail.smtps.from" instead.