Posts

Showing posts from January, 2012

objective c - NSTextField dynimic height in NSTableView -

Image
there nstextfield in nstableview. the height of text in window resizing increased. not grow cells in table view. in case, height of table view cell alter how like? in short, when resizing size of text view, want change size of cell. like this: (mac store) - (cgfloat)tableview:(nstableview *)tableview heightofrow:(nsinteger)row; { kfcustomcellview *cellview = [tableview makeviewwithidentifier:@"maincell" owner:self]; nsstring *comment = [[_commentlist objectatindex:row]valueforkey:@"comment"]; [cellview.comment setstringvalue:comment]; float cellheight = [comment heightforstringdrawing:comment font:[cellview.comment font] width:self.view.frame.size.width * 0.8]; if (cellheight > cellview.comment.frame.size.height) { return (cellheight + 65); } return 90; } use following approach resize cell height according textview content : - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowati...

ruby on rails - How to edit a model with its relations with form_for? -

Image
i have problem using form_for -tag in rails. i have following models: holidays id | name ___________|_____________ 123 | "asdf" 345 | "foo" 757 | "bar" holidates id | date ___________|_____________ 223 | 1998-03-11 445 | 1999-06-21 557 | 2009-09-20 countries id | name | country_code ___________|_____________|________________ 667 | "italia" | "it" 987 | "france" | "fr" 999 | "austria" | "au" r_countries id | country_id| holiday_id ___________|_____________|________________ 463 | 667 | 123 574 | 987 | 345 687 | 999 | 757 r_holidates id | holidate_id| holiday_id ___________|______________|________________ 142 | 123 | 223 253 | 345 | 445 36...

c# - Linkbutton is not working using ASP.NET -

i have written code comment , view more button ,comment working view more not working, code view more button mentioned below:- my aspx code here <asp:datalist id="datalist1" runat="server" datasourceid="sqldatasource1"> <itemtemplate> <div style="border-radius: 10px; height: inherit; padding-bottom:20px; margin-bottom:10px; padding-left:10px; padding-right:10px; padding-top:10px; width: 600px; font-family:verdana; min-height:40px; color: rgb(51, 51, 51); background-color: rgb(237, 237, 237); border-bottom: 2px groove rgb(54, 51, 51);"> comment: <asp:label id="commentlabel" runat="server" text='<%# eval("comment") %>' /> <br /> <div style="float:right; margin-bottom:5px;"> <asp:label id="personlabel" runat="server" text='<%# eval("person") %>' /> ...

gxt - Chromebook with EXT GWT 3.0.1 and GWT 2.5.1 -

i have developed app in java using gwt 2.5.1 , gwt gxt 3.0.1. although runs smoothly in macos , windows (any browser), havent still managed run in chromebook pixel. is there workaround or fix in order make work? thanks, solved the solution, found @ : http://www.sencha.com/forum/showthread.php?176332-gxt-beta-2-and-chrome-book cheers,

jquery - How to clear content div and reappear with javascript -

i using jquery custombox modal. have working fine want div behind (but not background image) disappear when modal clicked. have managed that, not sure on code make reappear again after modal closed. @ moment have refresh page in order come back. here code using far: http://codepen.io/doolz77/pen/esohb/ i have not included modal due amount of code, however, here link actual page to make modal appear click on 'joey' link. thanks! edit: @ moment controlled jquery. call placed in footer is: <script> $(function () { $('#fadein').on('click', function () { $.fn.custombox( { effect: 'fadein' }); return false; }); }); </script> this fades modal in , out. need place code here #wholepagecontainer div re-appear?? you need store html before deleting retrieve later. or can use show/hide reduce pain , achieve desired functionality: function clearbox(wholepagecontainer) { document.getelementbyid(wh...

ios - iPad Navigation between different subviews -

i'm experienced programmer, new ios/objc. need add feature existing ipad app, , i'm not sure how go it. the app has view (let's call infoview) several subcomponents, 1 of tableview (tableview), , 2 of buttons (buttona , buttonb) (plus other stuff that's irrelevant problem). when buttonb pressed, tableview needs replaced other view (let's call detailviewa) various items on. (buttona takes tableview - these buttons act pseudo tab buttons) when 1 of items in detailviewa selected, detailviewa needs replaced detailviewb. when detailviewb closed, detailviewa should re-appear. i believe can toggling between tableview , detailviewa hiding appropriate 1 when buttona/buttonb pressed, don't know how nicely deal drilling down detailviewb , again (preferably sliding animation) - thought perhaps maybe uinavigationcontroller, after research still can't see how i'd embed uinavigationcontroller inside subview. a picture tells thousand words, here's roug...

asp.net - How to Automatically Encrypt Web.config after installation -

i created web app. want encrypt web.config of application. i've tried cmd method , worked. want make auto encypted after installation. can me. you don't need encrypt whole web.config file. if keep connection string variable in web.config, can encrypt it. you can use following command encrypt connectionstrings. aspnet_regiis -pe "connectionstrings" -app "/sampleapplication" after process web.config files looks following example. <configuration> <connectionstrings configprotectionprovider="rsaprotectedconfigurationprovider"> <encrypteddata type="http://www.w3.org/2001/04/xmlenc#element" xmlns="http://www.w3.org/2001/04/xmlenc#"> <encryptionmethod algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" /> <keyinfo xmlns="http://www.w3.org/2000/09/xmldsig#"> <encryptedkey xmlns="http://www.w3.org/2001/...

gruntjs - Grunt jade compiler filling out empty attributes -

i'm using grunt-contrib-jade module compile jade templates, if leave attribute blank following line: article(ui-view) it compile to: <article ui-view="ui-view"></article> and break angularjs ui-router, not handle "ui-view" directive if named view (not want). of course it's option write jade file this: article(ui-view='') but that's not want, there way stop jade compiler filling out empty attributes? everything seems when there's doctype html @ beginning of .jade file. for partials not have doctype , can solved passing {doctype: 'html'} option when calling jade: jade -o "{doctype:'html'}" partial.jade it works grunt-contrib-jade adding doctype: 'html' options, so: jade: { devel: { options: { pretty: true, doctype: 'html' }, files: [{ expand: true, cwd: 'src', src: [ '**/*.jade' ], dest: ...

Python replace, using patterns in array -

i need replace things in string using array, can this: array = [3, "$x" , "$y", "$hi_buddy"] #the first number number of things in array string = "$xena here $x , $y." i've got array things replace things, let's called rep_array. rep_array = [3, "a", "b", "c"] for replacement use this: for x in range (1, array[0] + 1): string = string.replace(array[x], rep_array[x]) but result is: string = "aena here , b." but need lonely $x not $x in word. result should this: string = "$xena here , b." note that: all patterns in array start $ . a pattern matches if matches whole word after $ ; $xena doesn't match $x , foo$x would match. $ can escaped @ , should not matched (for example $x not match @$x ) use regular expression wraps source text whitespace look-behind , \b anchor; make sure include start of string too: import re pattern, replacement i...

vba - Row Comparision in Excel -

i'm facing problem 1 of macros i've written compare rows in sheet , highlight duplicates if any. but, taking longer time complete it's operation when there more number of records. when comparision starts, picks first record, compares remaining records , highlight if there duplicate , moves on second record , process continues till last record. can tell me better solution this? here code; rowcount = activesheet.usedrange.rows.count columncount = activesheet.usedrange.columns.count frownum = 1 rowcount rownum = 1 rowcount recfound = 0 colnum = 1 columncount if frownum <> rownum if activesheet.cells(frownum, colnum).value = activesheet.cells (rownum, colnum).value recfound = recfound + 1 end if end if next colnum if columncount = recfound errrow = 1 columncount ...

c# - Getting errors with dependent dropdown lists -

i have 2 tables in sql server , country_id country 1 india 2 australia 3 netherlands the 2nd table states state_id country_id state 1 2 abc 2 2 xyz 3 3 pqr 4 1 lmn 5 1 rst on page load country automatically come in dropdown1 , when select australia in first drop down, in 2nd drop down abc , xyz shown. i did getting bad query error. what correct query? my code is: protected void dropdownlist1_selectedindexchanged(object sender, eventargs e) { adap = new sqldataadapter("select state table_state ,table_country country = '" + dropdownlist1.selecteditem.tostring() + "' on table_state.country_id = table_country.country_id", con); con.open(); ds1 = new dataset(); adap.f...

javascript - Google Map in multipage form. -

i have multipage form. different pages divided fieldsets, , can navigate between them using buttons. on second fieldset, e.g second "page", i'd have map, , search field can type in address. the problem map won't show on second "page". if put map outside of form, shows , works intended. i use hpneo gmaps.js map. html: <fieldset> <h2 class="fs-title">foo</h2> <textarea id="" name="" placeholder="" rows="4" cols="50" class=""></textarea> <input id="" type="" name="" placeholder="" class="" /> <textarea id="" name="" class=""></textarea> <input id="" type="" name="next" class="next action-button" value="next" /> </fieldset> <!--page 2--> <fieldset> <h2 class="fs-t...

centos6 - CentOS - Process 'ksoftirqdx' Memory Hog -

by running 'top' command on server, notice process 'ksoftirqdx' running @ on 220%. have tried have google around , on stackoverflow. however, i'm unsure of how should proceed. i'm new server configuration, , rely on server run node.js setup. any appreciated. centos 6.5

Java windows 7 API to connect BLE device -

i'm looking java api on windows 7 reach bluetooth low energy device...i've seen microsoft supports gatt on windows 8 i'm wondering if there similar project available on windows 7 ? i've seen in previous post bluetooth low energy api windows 7.0 not available, ble quite huge topic may thing has changed ? thanks lot answers ! tiamat.

unable to access net.tcp wcf service from domain name -

i trying access wcf net.tcp service web client. when give server name in address works fine me. when tried domain name in address gives error. ( communication object, system.servicemodel.channels.servicechannel, cannot used communication because in faulted state. ) i have access service domain name on iis. please tell me possible access tcp service domain name(bdd.abc.com/services/services/organization.svc/)

java - Logic of code Guava's mightContain -

i going through code of guava library, interested understand probabilistic match code of mightcontain. 1 explain doing in code specially bit wise operator. here code.... public <t> boolean mightcontain(t object, funnel<? super t> funnel, int numhashfunctions, bitarray bits) { long hash64 = hashing.murmur3_128().newhasher().putobject(object, funnel).hash().aslong(); int hash1 = (int) hash64; int hash2 = (int) (hash64 >>> 32); (int = 1; <= numhashfunctions; i++) { int nexthash = hash1 + * hash2; if (nexthash < 0) { nexthash = ~nexthash; } // here, code identical previous method if (!bits.get(nexthash % bits.size())) { return false; } assuming code bloomfilter class, logic goes this: given key, perform of chosen hashes on key. use each hash pick bit number , check if bit set. if bits not set in filter @ position key cannot have been added. if o...

php - Yii comparing two attributes of different models -

in web application need compare attributes of 2 different models. have 2 models named "produceroffer" , "bookvegetable" . need compare 2 individual attributes . "booked_quantity" of "bookvegetable" table , "offered_qty" of "produceroffer" table . condition should check if "booked_quantity" less "offered_quantity". code wrote check condition public function comparebookedquantity($booked_quantity,$params){ if(bookvegetable::model()->findbyattributes(array('booked_quantity'=>$booked_quantity ))> $this->offered_qty){ $this->adderror($attribute,'please enter quantity lesser offered quantity'); } } public function rules() { array('offered_qty','comparebookedquantity'), array(' vegetable_id, offered_qty, unit_cost, unit_delivery_cost', 'required'), array(' offered_qty, unit_cost, unit_delivery_cost, boo...

javascript - Famo.us Scrollview height -

i trying add image below scrollview using famous sequentiallayout , im having problem scrollview's height. this how create scrollview. var scrollview = new scrollview({ direction: utility.direction.x, options: { size: [300, 300] }, paginated: true }); when add surfaces scrollview 250 height, scrollview's parent dom container (famous-group) containing these surfaces has width , height of 0. when adding scrollview within sequentiallayout first item, second item or surface height displayed on top of scrollview since has no height. any ideas how fix using famo.us? you can't set size - use modifier this. this render tree maincontext sequentiallayout modifier(size) scrollview modifier(size) image code snippet: // create components var scrollview = new scrollview(); var image = new imagesurface({ content: 'content/images/famous_symbol_transparent.png' }); // create...

asp.net - ERROR Could not update index entry. Action: 'Saved' -

we've taken on site based in sitecore , log file has occurring every 1 - 5 mins throughout day. anyone seen before , know cause , solution be? site suffers slowdown issue on 1 page load occurring ever few mins related. managedpoolthread #7 10:10:41 info starting update of index database 'master' (1 pending). managedpoolthread #7 10:10:41 error not update index entry. action: 'saved', item: '{0d80f9ba-5bbb-4a43-8b87-63e7a0f9a484}' exception: system.io.ioexception message: read past eof source: lucene.net @ lucene.net.store.bufferedindexinput.refill() @ lucene.net.store.bufferedindexinput.readbyte() @ lucene.net.store.indexinput.readint() @ lucene.net.index.segmentinfos.read(directory directory, string segmentfilename) @ lucene.net.index.indexfiledeleter..ctor(directory directory, indexdeletionpolicy policy, segmentinfos segmentinfos, textwriter infostream, documentswriter docwriter) @ lucene.net.index.di...

groovy - Grails integration testing NPE using h2 -

i trying write integration test in grails using h2 database. i'm using h2 don't have setup database in ci server. i'm having problems initializing data in database. this test looks right now: class pathgeneratorservicespec extends specification { def pathgeneratorservice def setup() { pathseed pathseed = new pathseed(id:1, seed:0).save() } void "getnextpath should return string"() { when: def retval = pathgeneratorservice.getnextpath() then: retval instanceof string } } however when try run test i'm getting npe: cannot property 'seed' on null object this service looks way: public string getnextpath() { def seedvalue = getnextseed() def path = createpath(seedvalue) return path } private def getnextseed() { def seedvalue pathseed.withtransaction { txn -> def seed = pathseed.lock(1) seedvalue = seed.seed seed.seed++ seed.save() } return seed...

ios - PKPassLibrary containsPass return wrong value -

i add pkpass library through pkaddpassesviewcontroller . pass visible in passbook app. the following code called: nsdata *data = [nsdata datawithcontentsoffile:filepath]; nserror *error; //init pass object data pkpass *pass = [[pkpass alloc] initwithdata:data error:&error]; if([self.passbooklibrary containspass:pass]) { passbooklibrary not nil. containspass returns yes on ios7 containspass returns no on ios6 there 2 types of pkpass. pklocalpass , pkremotepass. above created pkpass pklocalpass. check works pkremotepass. can obtain function: - (pkpass *)passfromlibraryfrompkpass:(pkpass *)pass { if (system_version_less_than(@"7.0")) { pkpass *librarypass = [self.passbooklibrary passwithpasstypeidentifier:pass.passtypeidentifier serialnumber:pass.serialnumber]; return librarypass; } else { return pass; } } furthermore, provisioning profile must passbook enabled. created new profile app id contains pass type ide...

php - how to perform NTLM authentication from browser in windows domain? -

i have check user credentials against windows domain controller. user credentials given in web gui, , nice not pass raw password client server. on server side have php , c++, can use winapi. have ideas how pass user login/password safely (for call logonuser), or other ways perform authentication, using ntlm or digest ? also, need list of groups (local , global, including indirect) in logged on user has membership. modifying existing php extension option.

Redis-objects list on a Redis-object in ruby -

i have redis-object's list. each object in list needs have list. class parent include redis::objects list :children, marshal: true end class children include redis::objects end the above code samples highlight relationship. include other things attr_accessors etc. my issue arrives when call children on instance of parent, such in example below: p = parent.new redis::list.new('some_key', marshal: true) << p p.children => nil i have working example using active record model list added it. including on redis-object seems give me issues. do need handle situation manually in way described in part 2 of redis-object documentation, or how have create redis-objects list on creation of parent object? thoughts creation implicit solved. had attr_accessor on parent, named children. clashed list defined name children. removing attr_accessor resulted in empty redis-objects list being returned, expected behavior.

how can i use foreach to get value and name php -

i want value of variable : $file = new filefromdb($_get['filename']); by trying code : foreach($file $key => $name){ print_r( "$key => $name"); } but dont work , when print $file show filefromdb object ( [filename:filefromdb:private] => tp4.php ) pliz me how can 'tp4.php' without syntaxe. $file object type filefromdb . filename private(!) property of object. (your var dump shows this). to access filename, filefromdb needs provide public method access property: class filefromdb ... public function getfilename() { return $this->filename; } ... } then use this: $file = new filefromdb($_get['filename']); $filename = $file->getfilename();

sql - Must declare the scalar variable error for stored procedure -

i have following stored procedure: create procedure validatelogin ( @password varchar(200), @username varchar(100), @ipaddress varchar(100) ) begin declare @qry varchar(max), @lockedip varchar(max), @lockedtime datetime, @timedifference int; set @qry = 'select iduser, username, firstname, lastname, idorg, users.idrole, roles.title [role], allowed_ip users, roles users.idrole = roles.idrole , lower(username) = @username , [password] = @password' ; select @lockedip = isnull(allowed_ip,''), @lockedtime = isnull(lockedtime, getdate()) users username = isnull(@username,''); select @timedifference = datediff(minute, @lockedtime, getdate()) if exists(select * users username = @username , password = @password , active = 1) begin if exists(select * users username = @username , isnull(islocked, 0) = 1) begin -- be1 if(@l...

javascript - Div Flickering onmouseover, onmouseout -

i have image , want div on when mouse on don't want onmouseout. wrote code , works it's flickering. here code: <div id="div" style="opacity:0.6; background-color:#2c3e50; width:136px; height:163px; z-index:199; position:absolute; vertical-align:top; font-size:120px; text-align:center; color:white; display:none;">1</div> <img alt="ברק לוי" src="" style="background-color:red; height:163px; width:136px" onmouseover="picture(true)" onmouseout="picture(false)"/> function picture(bool) { if (bool) { document.getelementbyid("div").style.display = "block"; } else if (bool==false) { document.getelementbyid("div").style.display = "none"; } } jsbin how can solve it? because need use onmouseout event on div <div id="div" style="opacity:0.6; background-color:#2c3e50; width:136px; height:163...

Activiti | Create a generic Service task to send XML Over HTTP -

as continued part of our activiti evaluation doing poc migrate our existing templates bpmn specs. need migrate existing tasks , 1 of critical task communicate mother application using xml on http. planning create service task (java delegate) purpose. task has reusable can use in different process definitions , in same definition different invocation within same definition. achieve this, service task needs provided initialization parameters xml body. initialization parameters include: url of mother application authentication credentials my query , confusion how best implement requirement. for example, can keep initialization parameters in properties file , create sub process own service task read file. sub process part of main process. alternatively, can read properties file in service task, instead of creating sub process what best practice/guideline type of scenario. the xml body (means content of xml) vary per process definitions , need parametrized. best way prov...

powershell - Error calling PutEx with a filtered array -

if call putex on adsi object in powershell works expected: $values = @("xyz", "abc" ) $user = [adsi]"ldap://cn=someone,cn=users,dc=acme,dc=com" $user.putex($ads_property_delete, "altsecurityidentities", $values) $user.setinfo() howver, if same thing filtering values where-object , error: $values = @("xyz", "abc" ) $filtered = @($values | ? { $_.startswith("x") }) $user = [adsi]"ldap://cn=someone,cn=users,dc=acme,dc=com" $user.putex($ads_property_delete, "altsecurityidentities", $filtered) $user.setinfo() the error is: exception calling "putex" "3" argument(s): "unspecified error . what's difference in 2 cases? what if try iterate through $filtered objects follows: $values = @("xyz", "abc" ) $filtered = @($values | ? { $_.startswith("x") }) foreach($item in $filtered){ $user = [adsi]"ldap://cn=someone,cn...

swing - Java access frame -

im trying following code using java.swing , java.awt init.java package es.com.gui; import java.awt.*; import javax.swing.*; public class init extends jframe { public init() { // start actual gui settitle("basic calculator"); setsize(300, 300); setlocationrelativeto(null); setlayout(new flowlayout()); setdefaultcloseoperation(exit_on_close); // add gui elements constructor constructor = new constructor(); jtextfield input1 = constructor.addtextfield("e"); input1.setcolumns(25); } } constructor.java package es.com.gui; import javax.swing.*; import java.awt.*; public class constructor extends jframe { public jlabel addlabel(string text) { jlabel label = new jlabel(text); add(label); return label; } public jbutton addbutton(string text) { jbutton button = new jbutton(text); add(button);...

prestashop - cannot import csv file -

i trying upload product csv file: 56456145614;1;test product;test;;;440;1;;;;;;;;;;;;;5;test product;;;;;;;;;;;;http://thedomain.com/imgimport/basic%20s:s-africatee-bk.jpg and error: test product (id 56456145614) cannot saved the prestashop version using: 1.4.8.2. any idea causing this? it turns out problem first parameter id 56456145614 . i used smaller number e.g. 1001 , worked.

java - Maven: Rename the application EAR -

i have maven 2 ear modules. for example, artifact id myapp. maven creates ear archives whith name myapp-1.0-snapshot.ear i want change default name. i have in parent pom.xml: <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>2.3.2</version> <configuration> <compilerversion>${java.version}</compilerversion> <source>${java.version}</source> <target>${java.version}</target> </configuration> </plugin> </plugins> <pluginmanagement> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-war-plugin</artifactid> <version...

How do I publish a .net c# project with a SQL Server database on another computer? -

i want publish desktop application in host computer. tried publishing sql server compact didn't work. changes should make in visual studio , sql server can install application in computer? what changes should make connection information shown here? private void frmlogin_load(object sender, eventargs e) { globalconnection.strserver = "myserver\\sqlexpress"; globalconnection.strpwd = "123456"; globalconnection.strdatabase = "nus"; globalconnection.struid = "sa"; globalconnection.setupconnection(); } if sql server express installed on target computer, have enabled "sa" account (it should disabled default) , set password "123456" "sa" account, , sql server express instance name sqlexpress , can modify connection information target local computer (regardless of name). globalconnection.strserver = ".\\sqlexpress"; if looking @ how automatically deploy , setup target ma...

Why won't JavaScript alert box work in this example? -

i trying validate 3 fields in html form using javascript. if of fields empty alert box appears message indicating fields empty. works fine. i'm having problem getting message (msg2) appear in alert box when form has been completed properly. code below-i know it's simple i'm missing if can help. thanks! var valid = true; var msg="incomplete form:\n"; var msg2="success! there no null fields."; if ( myname== "" ) { msg+="you need fill name field!\n"; valid = false; } if ( emailaddress == "" ) { msg+="you need fill in email!\n"; valid = false; } if ( commentstring == "" ) { msg+="you need fill in comment!\n"; valid = false; } if ((!myname=="")&&(!emailaddress=="")&&(!commentstring=="")){ return msg2; } if (!valid) alert(msg); return valid; } you're right, it's simple: return msg2; not open ale...

sql - How to put select statement returned into a variable -

i have stored procedure, create procedure [dbo].[craping_getfruitcrapedornot] ( @fruitid int, @crateid int, @fruitname varchar(100) ) select case when exists ( select craping.craped fruits inner join craping on fruits.id = craping.fruitid (fruits.fruittable = @fruitname) , (craping.fruitid = @fruitid) , (craping.crateid = @crateid) ) 'false' else 'true' end fruitnotcraped go now if exists instead of returning false then 'false' want return whatever returned select statement, not sure how though? then return select craping.craped fruits inner join craping on fruits.id = craping.fruitid (fruits.fruittable = @fruitname) , (craping.fruitid = @fruitid) , (craping.crateid = @crateid) declare @craped nvarchar(50) select @crape...

sql server - Displaying first row data in Report Header -

Image
i have report accepts empid parameter , list departments of employee. report run 1 employee @ time. list empid , empname in report result. now, need display emp name in report header . understand can use second query fetch emp name. however, looking alternative approach can use list emp name without running different query (since have data in query result). is there way in ssrs 2005 ? expected result you should able use first() function in expression snag first row of data dataset. may need order data, make sure you're getting right row, in situation may not necessary. note first() scoped grouping level.

osx - python idle 3.4.0 'print' syntax error -

the python idle throwing error @ print() function im not sure why heres code.. password = "cow" name = input() input("mr penguin: hello there mr penguin name? ") input("well, hello there"+name+"tell me password") input("you: password is, ") input("mr penguin: im little defh repeat that? ") input("you: password is, " print("pc police: stop! dont ever trust penguins data becuase told every 1 password "+ password) input("press enter exit") you missing parenthesis @ end of input on prior line. change: input("you: password is, " to: input("you: password is, ") for record, print fine. note when cryptic error, on previous line .

combobox - python ttk : How to detect if at least one of the widgets of a frame is updated by the user? -

i have frame contains multiple entry , combobox widgets. widgets filled default values when frame populated. i wondering if there simple way detect entry/combobox widgets have been updated user. if not, require me go through entry/combobox widgets 1 one , store new value if different default one. if able save time copying values of items have changed without need compare them first. i not sure understand trying achieve, 2 options can think iterate through each widget , compare reference values ( the 1 evoke in question ) bind edits on widgets , either store new values, or handle list of edited widgets the usual way perform former in gui through binding , callbacks. if use entry , ttk.combobox , can handle both stringvar , trace bindings. here snippet (inspired this answer ) illustrating callback aware of edited widget. handle damage list (with widgets have been edited) or data structure modified value. from tkinter import * import ttk def callback(na...

.net - RichTextBox removing images in windows 8 -

my application uses richtextbox control (.net 3.5) edit rtf documents. in windows xp 7 works fine, on windows 8 richtextbox reason not load images: if there image in rtf file, control remove when loading file (whether using load method or manually changing rtf property document's rtf code). is there explanation why happens? or how can resolved? edit: (detailed explanation on how recreate issue) i used simple rtf file, single .bmp image in (and nothing else). the application empty .net 3.5 application, single button , single textbox, following code in button's click event: dim rtb new richtextbox rtb.loadfile("c:\2.rtf") textbox1.text = rtb.rtf when run, after click button following appears in textbox: {\rtf1\fbidis\ansi\ansicpg1252\deff0{\fonttbl{\f0\froman\fcharset177{\*\fname times new roman;}times new roman (hebrew);}} \viewkind4\uc1\pard\rtlpar\nowidctlpar\qc\lang1037\kerning1\f0\rtlch\fs24\par } as can see, image omitted. i use visual s...

jquery - More efficient way of using javascript to stick columns to bottom of page? -

i've been designing web site while, 2 column layout, , want each column go bottom of page regardless of resolution. accomplish this, have 2 javascript files - 1 adjusts column length fit browser window, , other javascript file match resized one. 1 major problem have, if change browser window size, columns no auto adjust, may not go bottom of page. wondering if there way in 1 file, , importantly make columns stick bottom of page no matter window size is. here code each javascript file: adjust column height browser window: $(function(){ var grid = $(window).height(); var gridfinal = grid - 140; $('.grid').css({'min-height': ((gridfinal))+'px'}); }); adjust other column match resized one: window.onload = getidheight; function getidheight() { var myhomeheight = document.getelementbyid("home").offsetheight; document.getelementbyid("home-services").style.height = myhomeheight - 15 +"px"; } window.ad...

vb.net - .NET: Best practice for setting properties of main form from module -

i have main form. logic of application huge. have around 100 modules in application. in modules need set properties of main form's controls. i feel calling like public module somestuff public sub dosomething frmmain.mycontrol.location = ... end sub end module ... dirty. however, can not move modules main form. is there best practice deal such situation? edit: code works, feels ugly. thank you! there's number of options setting properties on form module, including: passing instance of form or form controls module function set returning values module function set on form form argument the form or specific form controls passed argument module sets properties. way not tied static instance of form. functions may still tightly coupled ui may make them harder unit test. returning values to keep separation between business logic , ui, return values need applied form via struct, class or dictionary. define method or function bind v...

html - random default thumbnail for blogger -

i'm learning html , css. i'm working on blogger blog template. my template has front page of post thumbnails. i have set class default thumbnail when posts not have image , have set url in css. .altthumbnails { background: url(myimagelocation.jpg); } is there way can make more 1 default thumbnail? chose maybe 3 images show @ random when there no post image. thanks replies you can not pure css. can either server-side code use or js 1 suggest. basicly 1 of easiest solution can make different classes each different image wanna use, can produce random number in js , use number apply different classes elements. here's example: demo in example there 5 different css class supply 5 different background-image , names end numbers 1 >> 5. .thumb_1 { .. } .thumb_2 { .. } .thumb_3 { .. } .thumb_4 { .. } .thumb_5 { .. } in javascript we're gonna loop through objects, generate random number 1 >> 5 , use number add new class this. var d...

Aligning Multiple Tables Horizontally using CSS or HTML for IE lower versions(6,7,8) -

my code works fine ie 10 , higher version, in chrome , firefox. users use either low version of ie. apart that, of code built lower version of ies. hence ie 10, have use compatibility mode. need align multiple tables side side. generating html tables using code. same table in control used multiple times in web page. in ie10, chrome, firefox - display property set inline-block working fine. not getting detected in compatibility mode. any suggestion help. thanks given below test code, content inside table changes. unable insert div rest of code. placing parenthesis around main div block {div id="scroll3" style="overflow-x:scroll; overflow-y:scroll; height:300px; white-space:nowrap;"} div style="width:auto;" table style="display:inline-block;"> <tr> <td> <asp:image id="image7" runat="server" imageurl="~/images/7.jpg" /> </td> </tr> </ta...

Validation rules are not being applied on create in cakePHP -

the problem having validation rules being fired on edit, none of them fired on create. here few of validation rules, though problem not here: var $validate = array( 'date' => array( 'notempty' => array( 'rule' => array('notempty'), 'message' => 'choose date' ) ), 'minutes' => array( 'rule'=>'minutes', 'message' => 'minutes cannot exceed 60', 'allowempty' => true ) and here forms (edit , add): <?php echo $this->form->create('event');?> <?php echo $this->form->input('date', array('class'=>'datepicker', 'type'=>'text', 'label'=>__('date*')));?> <?php echo $this->form->end(__('save edit'));?> <?php echo $thi...

performance - Speed of decoding ZXing and ZBar in android -

i've been testing zbar , zxing, saw lot of posts saying "zxing slow", "zbar faster", didn't saw tests made public. change code accept images gallery , repeat decoding of qrcode 50 times, made few tests, , zxing faster zbar, both libraries have same strange problem, first result 150 milliseconds, , next values faster, half of first decoding. i counting time of line in zxing result res = qrreader.decode(bbitmap); and in zbar one int result = scanner.scanimage(barcode); does know why first time decodes image 1 result of x milliseconds, , next times much faster? 'problem' (not problem, optimizations) of libraries image processing? i assume running these tests on desktop computer , not phone. regular javase jvms compile frequently-used code native code after have been used lot. first runs may slower. careful not measuring bunch of other jvm initialization in benchmark. it's best let things 'warm up' few iterations , star...

haml - what does ruby symbol -> do? -

this question has answer here: what -> (stab) operator in ruby? [duplicate] 1 answer options_from_collection_for_select(['all'], 'to_s', -> (input) { t("admin.mystring") }) i found line of code in haml file. please explain ->(input) do? , when use symbol -> in ruby? what ->(input) do? ->() { .. } called staby proc. and when use symbol -> in ruby? when want use proc object using kernel#lambda method. ->() { .. } syntactic sugar of kernel#lambda . ruby 1.9.1 introduces new, more concise syntax creating lambda methods. the stab operator named resemblance knife or stabbing motion: -> . following stab portion of operator, there argument list, in normal method. then, normal ruby block in braces. since lambda's argument list formal argument list, opposed block argument list, sev...

regex - php code with filter_var_array()/ filter_input_array not working properly -

a test of php code below ideone.com gives 2 errors "php warning: filter_var_array(): 'regexp' option missing in /home/rhlgyu/prog.php on line 18" the line $myinputs = filter_var_array($data, $args) . it may beginners experience dont understand error message, e.g., dont know goes wrong in code below. checked 2 regex expressions definitions ( regexp_multiple_names , regexp_phone_nl ) , okay. i suspect there error in definition of $args , cant find (when compare examples in http://www.w3schools.com/php/filter_validate_regexp.asp ). php code: define("regexp_multiple_names", "/^[a-za-z\s-]+$/i"); //expression check dutch phone numbers. number must start 0 , number of digits should 10. different area , country codes allowed. define("regexp_phone_nl", "/(^\+[0-9]{2}|^\+[0-9]{2}\(0\)|^\(\+[0-9]{2}\)\(0\)|^00[0-9]{2}|^0)([0-9]{9}$|[0-9\-\s]{10}$)/"); $data = array( 'city' => 'the hague', ...

google apps script - ScriptApp.getService().getUrl() returns an invalid URL which does not open -

i trying publish gas web app script itself. tried following code. function publish(){ var service = scriptapp.getservice(); if(!service.isenabled()){ service.enable(service.restriction.all); } var url = service.geturl(); logger.log(url); } surprisingly returns url fake. if go url nothing opens. if manually go script-editor , save new version , publish app modal popup, again running above code returns correct url. may cause ? not potential bug in app script ? this known issue - https://code.google.com/p/google-apps-script-issues/issues/detail?id=1703 please star more updates on it. @ point there no way programmatically deploy web app.

html - CSS comments layout -

i want make css layout comments. so comment block consists of 3 parts: user photo on left comment header (consisting of user name floated left , comment data floated right) comment body (floating user photo) http://dabblet.com/gist/10660127 have far. problem cant make proper comment heading. want align properly, if put many brs after .comment-title (but not best solution, here show desired result: http://dabblet.com/gist/10660333 ). any solution markup? you need add clear: both (or maybe clear: right , depending on how behaves avatar image) body class. you can give padding-top , too.

javascript - Add Comma After Every Three Digits in Input Value After OnClick Event -

Image
i have table/form calculates monthly payments mortgage. when calculate button pressed, javascript function make calculation based on values of inputs , set value of calculation inside of monthly payment input. problem when value set input, value gets displayed without commas. instance, 1543 instead of 1,543 . if knows anyway add commas monthly payment input great. here picture of mortgage calculator monthly payment input outlined: here code mortgage calculator: <form action="post" name="myform"> <table border="1" bgcolor="#006666"> <tr> <td align="center" colspan="2"> <script language="javascript"><!-- function carloancalculator() { form = document.myform loanamount= form.loanamount.value loanamount = loanamount.replace(/,/g, ""); parseint(loanamount); downpayment= "0" ...

python - how to send a plain query to elasticsearch with pyes -

i have plain query send elasticsearch through pyes without using pyes's builtin methods. query works when it's curled. further below code, can't make work. returns error when iterate on result object traceback (most recent call last): file "testqualifier.py", line 9, in <module> r in results: file "/usr/local/lib/python2.7/dist-packages/pyes/es.py", line 1384, in __next__ self._do_search() file "/usr/local/lib/python2.7/dist-packages/pyes/es.py", line 1212, in _do_search self._results = self._search_raw(self.start, self.chuck_size) file "/usr/local/lib/python2.7/dist-packages/pyes/es.py", line 1428, in _search_raw doc_types=self.doc_types, headers=self.headers, **query_params) file "/usr/local/lib/python2.7/dist-packages/pyes/es.py", line 931, in search_raw return self._send_request('get', path, body, params=query_params, headers=headers) file "/usr/local/lib/python2...