Posts

Showing posts from June, 2015

How can I implement pagination with python on google appengine? -

i'm building site reddit. objects sorted rating. hoping me implement pagination. want first load top 20 objects. on click of "next" button, want next 20 objects load based on 20th object's rating. here google docs: https://developers.google.com/appengine/docs/python/datastore/queries?hl=en . does know of way this? or there tutorial out there? this generic function using in order retrieve model instances along cursor. function takes parameters, reading them request. def retrieve_dbs(query, order=none, limit=none, cursor=none, **filters): ''' retrieves entities datastore, applying cursor pagination , equality filters. returns dbs , more cursor value ''' limit = limit or config.default_db_limit cursor = cursor.from_websafe_string(cursor) if cursor else none model_class = ndb.model._kind_map[query.kind] if order: o in order.split(','): if o.startswith('-'): query = query.order(

namespaces - Rails: Namespaced Class Method Referring to Wrong Class -

i have 2 models, 1 of namespaced: group::vote the other of not: vote the namespaced model has class method: def self.get_user_value(voteable) group::vote.where(:user_id => user.current.id, :voteable_type => voteable.class.name, :voteable_id => voteable.id).first.value end strangely, when call method so: group::vote.get_user_value(item) it gets sent named class method in vote model. doing wrong or encountering sort of hopeless bug?

c++ - Is this function's use of vector useless? -

i saw earlier , doesn't make sense me: void generate(std::vector<float> v) { float f = generate_next_float(); v.push_back(f); } if v sent reference or pointer, make sense. instead sent value, , therefore copied function, right? done v useless once function terminates v out of scope, deleted. am right? that is, function generate_next_float() might something, not useless, use of vector here seems pointless. f not depend on it, , nothing returned. yes, far vector concerned, generate() function pointless; changes v won't visible caller. i have feeling author of generate() missed pass reference overlook, not plan :-)

version control - Git pull only contents of a repository -

is there way git pull contents of repository without pulling home folder? example have bunch of files in repository called "sample" want pull contents of "sample" local repository called "local." not want pull "sample" such get: local -> sample -> [contents]. there way pull contents? i'm asking because operating on shared web server requires place content under specific folder (and named file names within folder). thanks. edit: wasn't being quite clear before. i'm working on local machine such only allowed change contents of folder , not contents of folder contains folder. option 1:: git clone <repo_path> <folder name> so in case, git clone sample.git local option 2:: the folder-name local repo present not have same of remote. do git clone ... git clone repo_pathorurl then rename folder so instance have sample.git remote repository, do git clone sample.git this clone reposito

3d - Extruding a graph in three.js -

is there way extrude 2d graph that's in 3d space 3d geometry actual volume? specifically, i'm trying create simple app play shapes 3d printer (i know there other known programs out there, i'd try myself). i've modified 1 of tutorials @leestemkoski (which awesome way... if you're reading this, thank you!) create mobius strip grapher here . has no volume , can't printed. i'd turn geometry actual volume (a watertight mesh). i've looked @ 2d extrusion examples these . none seem address i'm attempting do. spline example comes close don't know enough know if it's possible adapt purposes. i'm trying tinker examples , @ supporting docs/libraries, i'm having lot of difficulty this. is possible in three.js or going wrong way? thanks mrdoob. realized going wrong way. trying take graphed function , give volume know odd (versus creating real geometry). help!

Does the direction of a dependency connector matter in UML? -

i have come across several examples of dependencies e.g. include, extend utterly confusing. 1 example dictates include should in direction of; user profile --> login whilst extends should in direction of; validate credit card <-- print receipt. whereas required should in direction of; life of me don't why can't include place order --> create account also matter how these constructed i.e. user profile --> login (include) **vs** validate credit card (extend) ^ | | | print receipt i not sure understand every part of questions, here go: an include goes including included. denotes mandatory sub part of use case : including -----------> included <<include>> extend same include, sub part not mandatory. , unfortunately, arrow other way around. seems puzzle lot. including <----------- optionnally included <<extend>> when speak required, suppose an

php - Proper way to store a timezone in a database? -

let me explain: i'm not asking proper way store specific datetime's timezone in database. i'm talking timezones themselves. example: i have mysql table named 'users'. now, on table, wish have column contains timezone of wherever user lives (this provided user, chosen list). i'm working php, has list of timezone strings these: list of timezones america now, obvious solution (at least me) create varchar column in 'users' table, store timezone string used php in said column. now think it, assume i'll use php interact database table, while true now, might not in future. , (correct me if i'm wrong) php's timezone strings don't work other programming languages, maybe other languages have own 'constants' timezone handling. how approach saving user's timezone preference in db column, then? ideas appreciated. note: useful thing php's timezones that, if dst in effect, automatically take account, awesome. can see inte

python - last record in django models database -

i trying this: i have table of rating records of locations. in table, 1 location can have multiple rating scores. want restrict search last record of same locations. example: one location id =1 has 3 rating scores: 1, 2, 4. when user searchs rating score 2, location should not appear, because last record 4. edit there 2 tables(django models): location , rating. can this: all_locations = location.objects.all() then in template. locations_rating related_name foreignkey locationid in rating table. {% location in all_locations %} {{ location.locations_rating }} {% endfor %} models.py class location(models.model): locationname = models.charfield(max_length=100) def __unicode__(self): return self.locationname def latest(self): return rating.objects.values('rating').filter(von_location=self).order_by('-id')[0] class rating(models.model): von_location = models.foreignkey(location,related_name="locations

css - Complicated sticky footer and 100% content height -

i'm trying stretch content div 100% height: http://new.art-frame.spb.ru/catalog content div: <div id="rt-transition">...</div> footer: <footer id="rt-footer-surround">...</footer> the problem is, can't change html layout, css. (the best way use firebug/chrome inspector see what's about) html { position: relative; min-height: 100%; height: auto; margin: 0; } body { margin: 0 0 100px; min-width: 100px !important; } footer { position: absolute; left: 0; bottom: 0; height: 100px; width: 100%; } try changing height of html 100% instead of auto . then, play around css of elements inside make fit. if there excess overflow, use body { overflow: hidden; } to solve problem, although won't allow scrolling.

filtering only excel files in c# -

i working on excel sheets in c# , struck select excel sheets. tried following code openfiledialog browsefile = new openfiledialog(); browsefile.dereferencelinks = true; browsefile.filter = "excel|*.xls|excel 2010|*.xlsx"; // browsefile.filter = "link files (*.lnk)|*.lnk"; browsefile.title = "browse excel file"; if (browsefile.showdialog() == dialogresult.cancel) using code not getting excel sheets ended getting shortcut files. can suggest how can restrict shortcut files too. please see if ok below approach. in meantime let me try if possible using reflections. openfiledialog openkeywordsfiledialog = new openfiledialog(); openkeywordsfiledialog.initialdirectory = environment.getfolderpath(environment.specialfolder.mydocuments); openkeywordsfiledialog.multiselect = false; openkeywordsfiledialog.validatenames = true; openkeywordsfiledialog.dereferencelinks = false; // return .lnk in shortcuts. openkeywordsfiledialo

c# - How can I create a slideshow of images? -

i working on project c# in visual studio. have extract images database(microsoft sql server) , display them slide show. have put images in array? how make automated slideshow of images visual studio? have done basic extract , loading of images , database, stuck @ slideshow bit. a little appreciated!

MySQL Stored procedure says alias is undefined in select statement -

i have following statement, produces error. apparently alias "r" in first line of select statement not declared, it's right there @ end of statement. have ideas? #1327 - undeclared variable: r create procedure `get_series_completion`(in team1_id int, in team2_id int, in round_shortname varchar(5)) begin declare num_games_total, num_games_played int; select count(*) num_games_played, r.games_per_series num_games_total ( select game_id team_games team_id in (team1_id, team2_id) group game_id having count(*) = 2 , sum(standing = 0) = 0 ) s, rounds r on r.round_shortname = round_shortname; select num_games_played/num_games_total; end$$ you should select columns before clause, query should be: select count(*), r.games_per_series num_games_played, num_games_total ( select game_id team_games team_id in (team1_id, team2_id) group game_id

java - Container-Managed Transactions -

just clarification on understanding of how container-managed transactions(cmts) work in jpa - cmts spare application effort of beginning , committing transactions explicitly right? cmts can applied session , mesage-driven beans , not pojos? my rationale above questions - i'd know how access entity java-se application java-ee. need 2 separate persistence unit? i allow myself rewrite answer cause wasn't clear @ , worse, things wrongs. fact (and i) mixing ejb , jpa terminology. jpa talking entity beans. session bean (including cmt , bmt) part of ejb spec. in jpa talk container-managed , application-managed entity manager linked jta or resource-local persitence unit. here relevant part of jpa spec : a container-managed entity manager must jta entity manager. jta entity managers specified use in java ee containers. application-managed entity manager may either jta entity manager or resource-local entity manager. [...] both jta entity manage

javascript - how to get the base64 string of the clipboard data? -

i building xpcom component js. have got clipboard data in js, when data type image/png, want base64 string, code is: ...... trans.adddataflavor('image/png'); clipboard.getdata(trans, services.clipboard.kglobalclipboard); trans.gettransferdata('image/png', str, strlength); let mw = services.wm.getmostrecentwindow("navigator:browser"); data.data = str.value.queryinterface(ci.nsisupportscstring).data; data.data = mw.btoa(data.data); ... i can base64 string under linux, when run code in windows, got error: ns_nointerface: component returned failure code: 0x80004002 (ns_nointerface) [nsisupports.queryinterface] data.data = str.value.queryinterface(ci.nsisupportscstring).data; not konw how base64 string of image data in xpcom component, can give me answer? apparently images stored clipboard differently across platforms. check how jetpack reads them .

iphone - Cocoa/Cocoa.h file not found -

i using xmppframework in application. have imported cocoa/cocoa.h in .m file. when build project xcode shows error. error: "cocoa/cocoa.h file not found". how can solve error? if you're building ios shouldn't #import <cocoa/cocoa.h> . header exists on os x. ios need include various framework headers directly (e.g., #import <uikit/uikit.h> ).

c++ - Returning a value from Visitor pattern -

i have hierarchy follows: class element{ public : virtual void accept(visitor&) = 0 protected : element(); int num; }; class elementa : public element{ public : elementa(); void accept(visitor& v) {v.visit(this};} }; class elementb : public element{ public : elementb(); void accept(visitor& v) {v.visit(this};} class visitor{ public: void visit(elementa*); void visit(elementb*); }; edit: required add method int getnum() hierarchy provide value of num. however, need entire hierarchy compiled again , not allowed that. have change design of hierarchy in way recompilation of hierarchy not needed. what want not possible in cleanly designed way. have no idea, why complete recompile of hierarchy such problem, there solution technically possible without employing ub hacks reint

ios - IS it possible to customize the uitextfield so that it could look like on the picture -

Image
i have issue - need customize uitextfield this: is possible it???? , if yes, how??? yes possible. if using ib instance can set style of uitextfield follows: by setting text field's borders style property can simple placing uiimageview behind text field achieve desired effect.

Integrating google maps into Blackberry app -

i new blackberry app development(blackberry 7.1) .i need integrate google maps native blackberry application. should use google api v2 or v3? are there links or github projects readily available reference? should google maps installed in blackberry device? another requirement that 1) should possible plot multiple points on map

java - search a website in android -

i in development of android search particular word in website..for developed code...but not complete...is able help..it me...thank reading public class mainactivity extends activity { edittext et = new edittext(this); public void onclick(view v){ editable searchtext = et.gettext(); intent intent = new intent(this, com.example.app.mainactivity.class); intent.putextra("searchquery", searchtext); startactivity(intent); } } try it.... <edittext android:id="@+id/edt_search" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" android:ellipsize="end" android:hint="enter text" android:imeoptions="actiongo" android:singleline="true" android:textsize="14sp" /> edittext edt_search; edt_search = (edittext) findviewbyid(r

ios - empty tableview rows when parsing with NSXMLPaerser using ASIHTTPRequest -

i'm pretty new iphone development , have problem. after several hours of searching , digging in code understand source of problem (hope) not know how solve it. problem tableview cells loads before parser finish "[array count]" nil. when set 'number of rows in section' manually, table appear, after few sec , scrolling , down. i have 2 classes, 1 xmlparser , 1 show tableview. according read before opened question need reload tavleview data becuase have 2 various classes dont know how that. ideas? thanks in davance! here xmlparser code: - (void)parserdidstartdocument:(nsxmlparser *)parser { self.titles = [[nsmutablearray alloc]init]; self.descriptions = [[nsmutablearray alloc]init]; self.links = [[nsmutablearray alloc]init]; self.pubdate = [[nsmutablearray alloc]init]; } - (void)parserdidenddocument:(nsxmlparser *)parser { } bool isitem = no; bool istitle = no; bool isdesription = no; bool isimg = no; bool ispubdate = no; - (void)par

javascript - Update specific values in a nested array within mongo through mongoose -

i have following schema(without _id) - {uid: string, inbox:[{msgid:string, someval:string}] } now, in request msgid , use in following mongoose query this- my_model.findone({'inbox.msgid':'msgidvaluexyz'} , function(err, doc) { console.log(doc); return !0; }) now, problem whole document has specific message along other messages in inbox - output- {uid:'xyz', inbox:[ {msgid:,someval}, {msgid:'our queried msgid',someval}, //required sub array {msgid:,someval}, ] } now query can use specific sub array document inbox large looped through. use $ positional selection operator have returned doc include matched inbox element: my_model.findone({'inbox.msgid':'msgidvaluexyz'} , {'inbox.$': 1} , function(err, doc) { console.log(doc); return !0; })

Installing a fortran package with gfortran -

i want install package on 2 different machines. http://www.2decomp.org/download.html on mac laptop, when using makefile.inc.x86 makefile.inc, , make, works straight away without problem. on other machine when use same makefile.inc file, getting following error: [k00603@fe01p05 src]$make mpif90 -ddouble_prec -o3 -fcray-pointer -cpp -c decomp_2d.f90 gfortran: unrecognized option '-cpp' warning: decomp_2d.f90:20: illegal preprocessor directive warning: decomp_2d.f90:21: illegal preprocessor directive warning: decomp_2d.f90:22: illegal preprocessor directive warning: decomp_2d.f90:23: illegal preprocessor directive ------------------------------------------------------- --- around 50 more lines same warning -------- ------------------------------------------------------- in file decomp_2d.f90:32 integer, parameter, public :: ga_real_type = mt_f_dbl 1 error: symbol 'mt_f_dbl' @ (1) has no implicit type in file deco

c# - regex checking time -

i've got following regex: ^(?:(?:([01]?\d|2[0-3]):)?([0-5]?\d):)?([0-5]?\d)$ this accept 00:00:00 or 00:00 or 00 don't want this. can accept 00:01 or 00:00:01 not zeros. what have missed in regex? you can use negative lookaheads solve this: ^(?!^(\d|0)*$)(?:(?:([01]?\d|2[0-3]):)?([0-5]?\d):)?([0-5]?\d)$ the negative lookahead matches nondigits , zeroes. if have zeroes in time, fail match. you can see in more detail on www.debuggex.com .

objective c - Struct to NSData between Mac and iOS -

i have been working on problem while, have app running on mac, has co-ordinate data stored in struct this: struct xyz { float x; float y; float z; }; struct xy { float x; float y; }; struct object { struct xyz *myxyz; struct xy *myxy; }; this works expected, add struct nsdata so: struct object aninitialteststruct; nsmutabledata *mytestdataout = [nsmutabledata datawithbytes:&aninitialteststruct length:64 freewhendone:no]; bool = [mytestdataout writetofile:[nsstring stringwithformat:@"%@/filename.dat", docsdirectory] atomically:yes]; this works expected, file , looks there data in (for reference have used pointers , malloc aninitialteststruct still don't desired result) now on iphone, copy file project, , this: nsstring *filepath = [[nsbundle mainbundle] pathforresource:@"filename" oftype:@"dat"]; nsdata *myvecnsdata = [[nsdata alloc] initwithcontentsoffile:filepath options:nsdatareadinguncached error:&error]; if

Azure DNS hostname or IP reference in web.config? -

when connecting azure services in applications, preferable use dns hostname or ip? for example, have sql server hosted in virtual machine. should configure web.config 168.63.xxx.xxx or mysqlserver001.cloudapp.net ? thanks there no recommended strategy. while there unofficial statement public ip address of deployed cloud service (including virtual machine) not change until deleted (all vms same cloud service deleted, or paas deployment deleted), refrain relying on if can. can refer this blog post , links refers dilemma of "fixed ip address". i use dns name. use own domain name, cname-d xxx.cloudapp.net domain.

mysql - Float value conversion in the database -

in database fields (amount, balance) assigned floating value, have problem .if amount 1.56 take 1.6 alter table using round(amount,2) still shows same problem. if know please me. the float fields must declared float(some_integer, 1) show behaviour described. first integer in such declaration tells mysql how digits should visible alltogether, ones left decimal point + ones right it. have 3 digits left , 2 right of decimal point declare float(5,2) . like doan cuong mentioned better if choose decimal data type. see different behaviour of live here . to quote manual: the decimal , numeric types store exact numeric data values. these types used when important preserve exact precision, example monetary data. the float , double types represent approximate numeric data values. for additional info data types read more here .

Name cannot begin with the ':' character, hexadecimal value 0x3A” when I try to parse an xml -

i’m receiving error “name cannot begin ':' character, hexadecimal value 0x3a” when try parse xml. xml attached in image. please me resolve issue? i’m using below lines of code parse through document. i’ve no idea why error coming it’s crashing in client network. @ place, when runt code don’t error. the xml below. <fields> <field name="ows_target" value="jiradevinstance" /> <field name="ows_mappingxml" value="<mappings> <mapping id="1" source="enddatetime" sourcedatatype="datetime" sourcedataformat="mm/dd/yy hh:mm tt" target="duedate" targetdatatype="datetime" targetdataformat="yyyy-mm-dd hh:mm tt zzz"/><mapping id="2" source="issueraisedby" sourcedatatype="string" sourcedataformat="#-1:domain/username" target="reporter" targetdatatype="string" targetdataformat=

css - Background image paths won't render correctly -

i'm using django compress able use less files directly, instead of having convert them css files, works fine except background images paths doesn't translated correctly, reason. the less files linked in base.html this: <link rel="stylesheet/less" type="text/css" media="all" href="{{ static_url }}css/less/style.less" /> the images lives in static/images , less files in static/css/less . in less files link them this: background-image:url(".../images/sprite.png"); ...which should work fine, isn't working @ all. when looking @ rendered css background images paths is: "http://localhost:8000/static/css/less/.../images/sprite.png" what wrong , how can fix it? note: i've tried 1, 2 , 3 dots without luck. since images in static folder have go 2 directory: backgroun-image: url('../../images/sprite.png');

javascript - Is it possible to handle both async and sync function results inside a sync function in node.js? -

i'm working on library pre-processes less, stylus, etc. preprocessors can both async , sync in nature. because result used in build stage, writing blocking code here not issue. because preprocessors sync, , library expects sync functions down chain, wondering if it's somehow possible wrap preprocessor functions inside sync function can handle both sync , async results preprocessing function? basically possible this, somehow? syncfn = function(contents) { var res = syncorasyncfn(contents, function(err, contents) { res = contents }) // .. magic here waits results of syncorasyncfn return res; // return result function async or sync } sorry, that's impossible. whenever block of code running nothing can run inbetween, i.e. there no real parallelism in nodejs. therefore whatever do: res = contents line can fire after syncfn finishes whatever does, i.e. after synchronous operations finish job in block of code. this forces nodejs programmers use

ssl - Multiple certificates in TLS handshake "certificate" message -

my task parse server name https messages . have been asked parse "client hello" extensions , "certicate", "commonname" field . there multiple certificates in "certificate" message . example when open google https , listen via wireshark see 2 certificates first has commonname "*.google.com" , second has commonname "google internet authority" . first 1 server name connected second 1 authority signed certificate . my question can sure server name(google.com in case) in first certificate message . need care other certificates in certificate message if want servername . in fact, rfc 2246, 4346 , 5246 (respectively tls 1.0, tls 1.1 , tls 1.2) state server certificate should first 1 : "this sequence (chain) of x.509v3 certificates. sender's certificate must come first in list. each following certificate must directly certify 1 preceding it." it clear in ssl 3.0 : " certificate_l

java - Facebook SDK 3.0 upload picture to a facebook page (not in album) -

hi noob @ android development trying implement feature allow user post message on facebook page option upload picture/image there device sd-card. i using facebook sdk 3.0 i have managed make work not on facebook page wall, rather via users profile timeline. thanks in advance. * edit * case request_pick_image: if (resultcode == result_ok) { imageuri = intent.getdata(); asyncfacebookrunner masyncfbrunner1 = new asyncfacebookrunner(mfacebook); log.d(tag, imageuri.tostring() + " " + imageuri.getpath()); bundle params = new bundle(); try { in = new fileinputstream(getrealpathfromuri(imageuri)); buf = new bufferedinputstream(in); byte[] bmaparray= new byte[buf.available()]; buf.read(bmaparray); params.putbytearray("picture", bmaparray); } catch (ioexcep

forms - How do i change the color of the text to white instead of black in this CSS file -

i have css file. how change text white instead of black? #contactform { margin:50px auto; padding:20px; -moz-border-radius:15px; -webkit-border-radius:15px; border-radius:15px; } #contactform .captch span{ font-size: 16px; font-weight: bold; font-style: italic; } #contactform .form { text-align:left; font-size:18px; font-weight:normal; font-family:"times new roman", times, serif; color:#666; } #contactform input.text,textarea.text, select.text { padding:5px; margin-bottom:10px; background: url(images/input-bg.gif) top left no-repeat; } #contactform #result { color:#ff0000; font-style: italic; margin-bottom: 5px } #contactform .message { padding: 5px 3px; } #contactform img.loading-img { padding: 5px 3px; } #contactform textarea.text { height:100px; } #contactform input#submit { padding: 5px 10px; background: #f2f2f2; border:1px solid #e5e5e5; font-family

php - Accessing Method Through Service --- Symfony2 -

my controller purchaseorder controller <?php namespace cj\businessbundle\controller; use symfony\component\httpfoundation\request; use symfony\bundle\frameworkbundle\controller\controller; use sensio\bundle\frameworkextrabundle\configuration\method; use sensio\bundle\frameworkextrabundle\configuration\route; use sensio\bundle\frameworkextrabundle\configuration\template; use cj\businessbundle\entity\purchaseorder; use cj\businessbundle\form\purchaseordertype; /** * purchaseorder controller. * * @route("/purchaseorder") */ class purchaseordercontroller extends controller { /** * lists purchaseorder entities. * * @route("/", name="purchaseorder") * @method("get") * @template() */ public function indexaction() { $em = $this->getdoctrine()->getmanager(); $entities = $em->getrepository('cjbusinessbundle:purchaseorder')->findall(); return array( 'entities' => $entities, ); }

labels - In Blogger, using linkwithin with specific posts -

i want show linkwithin widget label type in entry page (item). i tried code accomplish it, not work. <b:widget id='html7' locked='false' title='linkwithin' type='html'> <b:includable id='main'> <b:if cond='data:blog.pagetype == "item"'> <b:loop values='data:post.labels' var='label'> <b:if cond='label.name == "films"'> <data:content/> </b:if> </b:loop> </b:if> </b:includable> </b:widget> updated answer (second try): the previous answer using widgets , when loop of labels there, available labels of blog want post having. so moved code different location in template , seems work should. find <data:postlabelslabel/> in template (80% down in template) , after closing </div> contains tag copy followin

xpages - comboBox generates a table instead of span in readmode web -

Image
when viewing xpage on web containing table combobox in column html generated domino creates table combobox span other components (tested on textfields , computedfields) . rendered pixel of vertical alignment difference annoys me. how can overcome this? <table> <tbody> <tr> <td colspan="3"> <table id="view:_id1:_id2:_id3:legend1:callbackfieldcontrolset:counterpartyname"> <tbody> <tr> <td> avanza sweden </td> </tr> </tbody> </table> </td> </tr> <tr> <td> <span id="view:_id1:_id2:_id3:legend1:callbackfieldcont

gdb - Make color escape codes work in cgdb -

i have following function residing in ~/.gdbinit : define foo echo \033[34m echo testing...\n echo \033[0m end when running foo in gdb prints testing... in blue, however, when running in cgdb result is: [34mtesting... [0m how can enable color escape codes in cgdb ? unfortunately, gdb "window" in cgdb not full-fledged terminal... can handle basic text i/o not render terminal escape sequences such colors, cursor movement, etc.

jquery - SCRIPT5: Access is denied IE09 and IE10 -

i'm using rails 3.2.11. have implemented file upload concept. working fine firefox , chrome browser. form <iframe id="upload_target" name="upload_target" style="display:none;"></iframe> <%= form_tag(url_for(:action => 'add_image'), :target => 'upload_target', :id => 'add_image_form', :enctype => 'multipart/form-data', :multipart=>true) %> <%= text_field 'image_asset', 'name', :size => [60,40].min, :maxlength => "60", :id => "focus", :style=>"display:none", :value=>"site_logo" %> <%= text_field 'image_asset', 'image_type', :value=>"icon",:style=>"display:none"%> <input type="file" id="file" name="image_form_file" size="36" style="display:no

directoryservices - edirectory read custom property value Unknown error (0x8000500c) -

strange things happen... i forced move new developer machine (windows server 2008 r2 2012). exact same code doesn't work on new machine. public override membershipusercollection findusersbyemail(string emailtomatch, int pageindex, int pagesize, out int totalrecords) { membershipusercollection retvalue = new membershipusercollection(); string ldapconnectionstring = _configuration.getconnectionstring(); using (directoryentry de = new directoryentry(ldapconnectionstring, _configuration.searchaccount, _configuration.searchaccountpassword, authenticationtypes.serverbind)) { string filter = string.format("(&(objectclass=person)(customemail={0}))", emailtomatch); directorysearcher ds = new directorysearcher(de, filter, new[] { "cn", "customemail" }, searchscope.subtree); searchresultcollection collection = ds.findall(); totalrecords = collection.count; int pagescount = (totalreco

On delete set null creating table in mysql -

i create table named patientmedicinecategory . given below:- create table patientmedicinecategory ( pmc int(11) not null auto_increment, patient_id int(11) not null, med_id int(3) not null, cat_id int(3) not null, testname varchar(100) not null, primary key(pmc), unique key(patient_id, med_id,cat_id,testname), foreign key(patient_id) references patient(patient_id) on update cascade on delete cascade, foreign key(med_id) references medicine(med_id) on update cascade on delete cascade, foreign key(cat_id) references category(cat_id) on update cascade on delete set null )engine=innodb; my patient table :- create table patient ( patient_id int not null auto_increment, salutation enum('mr.','mrs.','miss.','dr.') not null, name varchar(50) not null, email_id varchar(100), year int(4) not null, month int(3), day int(3), sex enum('m','f') not n

windows - Powershell script throwing error: You cannot call a method on a null-valued expression -

just trying troubleshoot issue. think may powershell script wrong. please forgive me if answer obvious. here have: $pluginpath = 'd:\program files\nsclient++\plugins' $results = cmd /c "$pluginpath\ipmiutil.exe" sensor -s # status of memory $memstatus = ($results | select-string "snum 60").line.split('|')[-1] -replace '\s+' error: invalidoperation: (split:string) [], runtimeexception and notification type: problem service: hardware host: x state: critical date/time: x additional info: **you cannot call method on null-valued expression.** any massively appreciated

java - The shape is not getting changed within if and else if statements in Jfreechart -

Image
in single series i.e in time series chart different shapes have obtained . not coming... pls refer following code , tell me mistake have committed ? timeseriescollection dataset = new timeseriescollection(glucoseries); jfreechart chart = chartfactory.createtimeserieschart("glucometer","date","value",dataset,true,true,false); xyplot xyplot = (xyplot)chart.getplot(); xylineandshaperenderer renderer = (xylineandshaperenderer) xyplot.getrenderer(); int glucovalue = integer.parseint(glcvalue); if(glucovalue<80) { renderer.setseriesshape(0,new ellipse2d.double(-3.0,-3.0,8.0,8.0)); renderer.setseriesshapesvisible(0,true); } else if(glucovalue>80 && glucovalue<100) { renderer.setseriesshape(0,shapeutilities.createuptriangle(4.0f)); renderer.setseriesshapesvisible(0,true);

vb.net - Taking "ten" values from a textbox, splitting them into 10 single values and outputting into a column -

i using modified version of below code send information entered in combo boxs , textboxs on form 2. labels form3 public class form1 private sub button1_click(sender object, e eventargs) handles button1.click dim f new formvb2() f.textbox1value = textbox1.text f.showdialog() end sub end class public class form2 public property textbox1value string private sub form2_load(sender object, e eventargs) handles me.load textbox1.text = textbox1value end sub end class thanks @steven doggart, i looking take process little further.... lets textbox5 on form 2 has following data... 27, 34, 56, 94, 23 want data taken form3 , output on 5 differnt labels 27 34 56 94 23 the problems thinking straight away need labels in place ready input these (if data can split) or can coded create , place data? form2 has 10 text boxs , each of these have 1 50 differnet values input, , want take data each textbox on form2, output them individual values on form3 in column. if ever hit 15rep can put

xamarin.android - Error when building project with monodroid/mvvmcross -

i've got error when try build project (monodroid/mvvmcross). message error : error 37 type 'android.app.listactivity' defined in assembly not referenced. must add reference assembly 'mono.android, version=0.0.0.0, culture=neutral, publickeytoken=c4c4237547e4b6cd'. someone have idea how solve problem ? strange because there wasn't error before. this error located in mvxdialogactivityview.cs (cirrious.mvvmcross.dialog.droid) i think problem parts of code compiled against xamarin.android while others compiled against mono android. see: http://forums.xamarin.com/discussion/1476/changes-to-assembly-strongnames-in-xamarin-android-4-6-0 you need recompile parts of application target same version of xamarin's products.

To Create Android Application by using Google Maps Android API v2 -

i want build android application uses google maps android api v2. so, followed link - link . following steps prescribed in link, able generate api key. further after completing steps tried run app. faced following error. 04-05 10:01:56.442: e/androidruntime(6170): fatal exception: main 04-05 10:01:56.442: e/androidruntime(6170): java.lang.runtimeexception: unable start activity componentinfo{com.example.task/com.example.task.mainactivity}: android.view.inflateexception: binary xml file line #5: error inflating class fragment 04-05 10:01:56.442: e/androidruntime(6170): @ android.app.activitythread.performlaunchactivity(activitythread.java:2142) 04-05 10:01:56.442: e/androidruntime(6170): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2167) 04-05 10:01:56.442: e/androidruntime(6170): @ android.app.activitythread.access$600(activitythread.java:134) 04-05 10:01:56.442: e/androidruntime(6170): @ android.app.activitythread$h.handlemessage(activity

java - Struts2 Annotations validate String using RegexFieldValidator -

i trying use struts2 annotations validate fields of bean. in case, validate phone number string regex. i found @regexfieldvalidator annotation, included in class , made tests: @requiredstringvalidator(message="phone required.") @regexfieldvalidator( message="invalid phone", expression="\\([\\d][\\d][\\d]\\) [\\d][\\d][\\d]-[\\d][\\d][\\d][\\d]") public void setphone(string phone) { this.phone = phone; } however, regex expression doesn´t work. tried "\d{9}" , "[0-9]{9}" . type=validatortype.simple. the required stringvalidator works properly...what´s going on here? possible use validator properly? thanks in advance try with @regexfieldvalidator(type=validatortype.field, message="invalid phone", expression="\\([0-9][0-9][0-9]\\)\\s[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]")

php - Accessing socket service using persistent socket -

i have tcp socket service myserv running on background (using java, doesn't matter though), , web server php accesses myserv using persistent socket (pfsockopen). the problem is, if 1 php request stopped whatever reason, leaves un-read data in persistent socket, , following php request error when reading socket. i wonder how's other services similar scenario (like php-mysql, php-memcached) dealing problem? more specificly, how can php tell used persistent socket clean?

ios - How to implement those tables please -

Image
i have implement tables below know can use custome cell 2 labels idea how implement overall shape vertical , horizontal labels maybe set regular view controller. add collection view, make cell large. in collection view cell add label on side (this become light blue box). right next add table view sections. header red , dark blue area. this work, need flexibility of starting view controller, , doing collection , table view through delegates

Pdb and Python's core module loading when set_trace() is called: possible? -

recently find myself using pdb lot more usual. have beautiful shortcut adds import pdb; pdb.set_trace() need in code. now, everytime i'm in pdb, want emulated interactive console found in python's code module , avoid using oneliners while debugging. this requires typing !import code; code.interact(local=vars()) every time , it's utterly annoying, since have keep ready copy-and-paste or type manually. is there way have loaded every time set_trace() called? all why not import code; code.interact(local=vars()) instead of import pdb; pdb.set_trace() ?

How do I add a class to an element's parent using jQuery? -

i have music page set , when play button clicked song, class changes buttons_mp3j buttons_mp3jpause . when class buttons_mp3jpause , want target parent li.song , add class it. <li class="song"> <div> <span> <span class="buttons_mp3jpause"> </span> </span> </div> </li> i have tried following code didn't work. $(".buttons_mp3jpause").parents("li.song").addclass("playing"); where did go wrong? edit $('.haiku-play').bind('click', function() { $('.haiku-player').jplayer("pause"); }) edit 2 <article> <ul> <li class="song">yadayada</li> <li class="song">yadayada</li> <li class="song">yadayada</li> <li class="song">yadayada</li> </ul> </arti