Posts

Showing posts from June, 2014

accordion - Remove class from all <a>-tags within a certain div using jQuery -

i'm using jquery , have managed paste simple accordion can have 1 section of accordion open @ same time. each section of accordion has subitems has "+"-sign indicate this. when section clicked , content expanded, "+"-icon switches "-". this works fine , dandy until need have 2 (or more) accordions on same page . way works now, script switches expanded divs "-"-icons "-" "+". want +/- icons within same div latest clicked link switch, way now, icons of expanded sections changed when link clicked. here script used: $(document).ready(function() { $(".accordion dd").hide(); $(".accordion dt a").click(function(){ $(this).parent().next().siblings("dd:visible").slideup("slow"); $(this).parent().next().slidetoggle("slow"); if ($(this).is("expanded")) { $(this).toggleclass("expanded"); } else { ...

java - Why is my TestNG dataprovider website blocking? -

i'm using testng, selenium grid , using @dataprovider annotation read testcase values excel sheet. testing 2 sites offer same products using same field names etc., under different brand names. site processes without issues whereas site b seems aware automation script been run on , redirects contact screen preventing me completing test case. when log on manually, can proceed without problem. my question is, there tools can prevent use of data injection @dataprovider annotation, and, if so, there way around them?

c# - can't find main static main method in WCF -

i created wcf service , faced problem. need update database periodically, couldn't find static method main, whould without client interaction. can do??? wold suggest in such case? there no main method (or similar entry point) in wcf. need host wcf service in process (such windows service, or iis or self host) "activate" , make available other processes. one of concepts in wcf write service code function need without having worry infrastructure , hosting. once have written service logic, can decorate , configure service expose other processes. using approach means can change how service exposed other processes without re-writing actual service logic - change configuration. hence, main entry point specific how choose host , expose wcf service outside world. just google around "wcf hosting" , find lots of information. if don't need expose service logic external process (which sounds maybe case question) maybe don't need use wcf , can writ...

How to force IntelliJ to always search in "Whole Project" -

i use find in path function ctrl+shift+f , searches text strings in several files. one thing run though, search know exists in @ least 1 file, 0 results or find of files contain search term. then realise scope setting in find dialog box has been set module or directory reason rather "whole project" want. what fools me here seems happen - i'll have scope set whole project want to, else. how intellij decide scope use? also, there setting can used force intellij select "whole project" default? just collapse project tab before: command + 1 or alt + 1 the default selection depends on context launched search. if have project tab open folder/file selected search in folder or parent of file. to search default close panel (this make context whole project) , press search shortcut , scope properly.

android - Why are the 9 patch not working at all in my app? -

Image
i trying use 9 patch pictures in app. the image quite clear , work pretty in graphic tool provided sdk: picture this: and tool seems work fine: unfortunately, such simple layout, rendering bad on device , 9 patch not work @ all: <textview android:id="@+id/platenumber" android:background="@drawable/plate_fr" android:layout_width="320dip" android:layout_height="wrap_content" /> any idea on doing wrong? edit: my picture named *.9.png the black lines have totally black(rgb:#000000) , transparent zone around black lines totally transparent.

iphone - How to Show Video thumbnails in UITableview? -

Image
in application video link sever in uitableview .all these link store in text file on server.but want thumbnails of these link in uitableview. here image . as screen shot show link fetch server no thumbnails of these link show in red circle. these red circles webviews.here code. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *customcellidentifier = @"customcellidentifier "; customcell *cell = (customcell *)[tableview dequeuereusablecellwithidentifier: customcellidentifier]; if (cell == nil) { nsarray *nib = [[nsbundle mainbundle] loadnibnamed:@"customcell" owner:self options:nil]; cell = [nib objectatindex:0]; } // set cell. nsstring *embedhtml = @"\ <html><head>\ <style type=\"text/css\">\ body {\ background-color: transparent;\ color: white;\ }\ </style>\ </head><body style=\"margin:0\">\ <embed id=\"yt\...

javascript - Google Chrome userscript vs extension? -

i'm looking @ various options have enhance browsing experience. found ton of userscripts available @ userscripts.org . but, reading on google chrome extensions (which seem similar userscripts). i'm wondering if there advantages using userscript vs. extension? 1 thing can't seem working using either of these techniques inject scripts dom can have javascript code access pages' javascript methods. works fine single userscript install, when attempted convert userscript extension, did not seem work. though, wasn't sure if did wrong or if can't work @ all. the main reason ask because after started working on own userscript ran issue script file grew large , repetitive other scripts. chrome doesn't support "@require" option can't organize "common" code way, lead me think should looking @ extensions instead. so, possible use "script injection" or "location hack" in extension javascript can execute on dom , acces...

c# - Error while updating to database : Oracle -

i working in .net windows application. in app.config had given connection string this... <add connectionstring="data source=(description=(address=(protocol=tcp)(host=192.168.1.101)(port=1521)))(connect_data=(sid=prod)(server=dedicated)));user id=test;password=test;" providername="system.data.oracleclient" name="connectionstring" /> i doing update process. once breakpoint reaches update method, getting message this.. ora-12504: tns:listener not given service_name in connect_data what should this... my tnsnames.ora is, prod = (description = (address = (protocol = tcp)(host = localhost)(port = 1521)) (connect_data = (server = dedicated) (service_name = prod) ) ) as remember when want specify connection string oracle connection, service name should provided , rest of information loaded service name. romil said in comment, have make service name in tnsnames.ora. there gui tool creating service names. service name connec...

objective c - iPhone iOS how to instantiate a black and white CGColorSpaceRef? -

i'm working excellent example of converting image grayscale: convert image b&w problem cgcontext - iphone dev however, purposes, have only pure black , pure white left in image. it appears so, need pass black , white color space recolor method using call: cgcolorspaceref colorspace = cgcolorspacecreatewithname(/*black , white name*/); however, unable find proper ios color space names. found mac, , "color space names" referenced ios docs not point anywhere. how can create black , white cgcolorspaceref? thank you! i not familiar black , white color space can calculate total average rgb value pixels (lets call totalavg ) , use threshold. meaning each pixel if rgb average greater calculated totalavg set pure white, otherwise set pure black. i agree bit of more work thats whay can think of unless find colorspace looking for.

android - Is it possible to get the image path of an image in an image view? -

i have set image in image view. want save state , need know image path of image. there way that? update: // decode, scale , set image. bitmap mybitmap = bitmapfactory.decodefile(selectedimagepath); bitmap scaledbitmap = bitmap.createscaledbitmap(mybitmap, new_width, new_height, true); mybitmap.recycle(); mybitmap = null; mimageview.setimagebitmap(scaledbitmap); not directly, once image set on imageview turned drawable , else forgotten. however, use tags purpose. view can have tag associated represents metadata view. like: imageview iv; //declared elsewhere uri imagepath = uri.parse("..."); //set image iv.setimageuri(imagepath); //add path value tag iv.settag(imagepath); //sometime in future, retrieve uri path = (uri)iv.gettag(); you might consider creating subclass of imageview encapsulate function make code little easier read , maintain. hth

java - Checking if JTree node exist using path -

Image
i have classic jtree populated nods. lets assume tree looks this: root |-fruit |--apple |--orange |-objects |--table |--car is there way in java check if node exists using assumed path this: treenode found = model.getnodeornull("\\fruit\\apple") so if node in given location exists it's returned, if not null returned? there such mechanism in java? you might experiment along these lines. example output food:pizza found true od:pizza found false sports:hockey found true sports:hockey2 found false treenodelocation.java import java.awt.borderlayout; import java.awt.event.*; import javax.swing.*; import javax.swing.text.position; import javax.swing.tree.treepath; public class treenodelocation { private jtree tree = new jtree(); treenodelocation() { jpanel p = new jpanel(new borderlayout(2,2)); final jtextfield find = new jtextfield("food:pizza"); find.addactionlistener(new actionlistener() { ...

Custom Suggestions in Search Widget (Android ICS) -

i have action bar search widget in ics app. want user can search stuff came app. therefore want use search widget, displaying result list updates itselfs when user typ in new char (same functionality play store). have implemented searchview.onquerytextlistener in activity , implement 2 methods onquerytextchange(string newtext) , onquerytextsubmit(string query) . in onquerytextchange call service, returns values typed suggestion. have no plan, how display suggestion list. read articles on developer.android.com , far understand old search implementation (< honeycomb). in search widget api examples suggestions apps, installed on system, served searchmanager . havn't found tutorial or example covers topic (custom suggestions in search widget), know this? @override public boolean oncreateoptionsmenu(menu menu) { getmenuinflater().inflate(r.menu.search_menu, menu); searchmanager searchmanager = (searchmanager) getsystemservice(context.search_service); ...

c++ - Storing a boost::signals2 signal in a map? -

i facing following problem: want store number of boost::signals2 signal variables in map. since these signals non-copyable , not work. how can work around this? have found this older question . in it, poster suggests storing signals shared_ptr . only way of doing it? have drawbacks, or, more important, safe ? as has been pointed out commentators: using shared_ptrs signals safe. implementation works , has been thoroughly tested in meantime , happy report there indeed no problems :)

Are pointers to arguments in Objective C methods are const by default? -

there methods in cocoa classes accept address of pointer. commonly argument address of future nserror * object in coredata validation methods (among others). way possible put custom or owned object place of address given argument points to. my question is: why can't simple pointer arguments? e.g. let's have method: - (void)addobject:(id)someobject toarray:(nsmutablearray *)array; i can pass mutable array second argument, call addobject: on , after method call array modified. why not done nserror * objects? pointers passed methods defined const default? avoid accessing null ? why not done nserror * objects? because there's no such thing nsmutableerror . example works because can modify contents of array without modifying pointer array itself. however, since nserror instances immutable, cannot modify nserror . such, must create new error object. , if want return error object along other piece of data, @ least 1 of must done via out-parameter (...

r - Analysis of complex survey design with multiple plausible values -

i working several large databases (e.g. pisa , naep) use complex survey design replicate weights , multiple plausible values. can address former using survey package. however, there exist r package/function analyze latter? for reference, have found article provide overview of issue: http://www.ierinstitute.org/fileadmin/documents/ieri_monograph/ieri_monograph_volume_02_chapter_01.pdf i'm not sure how general idea of 'plausible values' differs using multiple imputation generate several sets of imputed values (such the amelia package does). thomas lumley's mitools package can used combine various sets of imputed values, , might case can used combine sets of plausible values obtain 'correct' standard errors of estimates.

sql - get data into report ssrs -

Image
i'm working on first ssrs report project , i'm bit confused. i've design own custom report looks invoice template in excel. goal have invoice/report in schedule send out customers on monthly basis. however, problem getting data fields of report. i've been using tables insert data not working out well. created data set following query: select convert(varchar(10), getdate(), 103) [dd/mm/yyyy] the column: dd/mm/yyyy not exist in database, current date. receiving error saying: the value expression field:select convert(varchar(10), getdate(), 103) [dd/mm/yyyy] contains error. expression expected there other calculation other parts of report. question is, data want put tables have column in database? or can create them using ssrs? thanks please go through link understand how create datasets , populate date on reports working datasets the steps create dataset retrieves current date 1.create new dataset .go data tab of report , click on drop ...

jquery - JavaScript: Cant work out how to get a roll over to work on multiple elements -

this 1 simple, has been racking brain ruins few days now. have php script outputs images, , on each out-putted image, when user hovers on elements shows info & options. can seem work out how each element it's id, doesn't work, allowing first outputted image show it's rollover, id's should unique way useless. did getting elements classes in jquery had problem, every time hovered image of hidden elements shown, mouse on over image 1 showing options images 1,2,3,4,5,6,7,8.... grrrr! so tis original javascript used: function thumbtoggle() { var opt = document.getelementbyid("rem"); var text = document.getelementsbytagname("thumbrem"); if(opt.style.display == "block") { opt.style.display = "none"; text.innerhtml = "&darr;"; } else { opt.style.display = "block"; text.innerhtml = "...

How to clear or change the navigation history of Jquery Mobile? -

i have phonegap app using jquery mobile. @ page, cannot let user go last page visited. the pages order this: (1)index -> (2)listing items -> (3)form submited -> (4)sucess page what need: want clear history when user @ page 4 , set page 1 last , visited in case of user tries go back. maybe that's not totally possible, accept suggestion. i imagine jquery mobile stores navigation history in kind of array, , hope can find that. in advance! edit: i'm using multi-page template , single html page, divs works pages managed jquery mobile. basically have 2 history "pots" need tamper with. browser , jqm. jqm urlhistory can modify jqms urlhistory easily. jqm code: urlhistory = { // array of pages visited during single page load. // each has url , optional transition, title, , pageurl // (which represents file path, in cases url obscured, such dialogs) stack: [], // maintain index number active page in stack activein...

c# - Reading xlsx saved as xls with LinqToExcel -

look @ post: excel "external table not in expected format." i have same problem depicted in post i'm using linqtoexcel read file instead of plain queries. what linqtoexcel equivalent setting connection string answer post suggests? here code i'm using: var excelom = new excelqueryfactory(ppatharchivoom); var despachosclient = c in excelom.worksheet<registrodespachoom>("tabla_1") c.destinat.contains("sometext") select c; //identificar los despachos asociados números de documento sin datos aún. foreach (registrodespachoom despacho in despachosclient) { ... and problem is: "external table not in expected format" in foreach start. edit (my problem solved question remains unanswered): i'm using epplus instead of linqtoexcel task , working ok now. you need use ace database engine instead of jet database engine. you can linqtoexcel setting databaseengine pro...

c++ - Is it possible to keep DLL in memory after calling process exits? -

i have dll takes 5 10 seconds load, means have wait long every time compile , run executable uses it. there way keep dll loaded in memory can accessed every time compile corresponding executable? i'm compiling program on qt mingw, if that's relevant. edit: no luck far. loading dll on program seems have no effect (the original program still loads dll, , takes long so). guess need load dll , functions differently if they've been loaded program, don't know how this. right i'm using loadlibrary , getprocaddress. the easiest solution (assuming msvc++) make dll delay-loaded. trade-off of course initializaton still has happen, no longer delay other parts of program. e.g. can on background thread.

git - Putting my project in github repo -

when created first project,i created repo (say project1 ) on github account , cloned in machine. , pushed whenever code in machine updated. now created project- project2 in machine. tested it, created local repo using git init . want push project github. purpose created repo on github named project2 . has .gitignore , readme.md files in it. now, how add existing code this? when cd'd project2 directory , tried git push , error: fatal: no destination configured push to. i tried git push project2 fatal: 'project2' not appear git repository fatal: remote end hung unexpectedly please me correct error you need add new repository remote: git remote add project2 git@github.com:nickname/project2.git

sql - long running sp -

the following sp: have stored procedure runs anywhere 1/2 minute 4 hours (during nightly processing): update tablea set tablea.other_flag_50 = isnull(staging.other_flag_50, 0) tablea inner join ( select acct_nbr, appl_code, other_flag_50 tableb ) staging on tablea.lnhist_acct_nbr = staging.acct_nbr , tablea.lnhist_appl_code = staging.appl_code i ran blocking reports in profiler 2 nights in row, first @ 10 minutes interval @ 5 minutes. stored procedure never shows being blocked (but blocks other queries). any ideas on optimizing this? creating view join help? (acct_nbr, appl_code, other_flag_50 tableb) thanks!! have tried doing inner join directly tableb? update tablea set tablea.other_flag_50=isnull(tableb.other_flag_50,0) tablea inner join tableb on tablea.lnhist_acct_nbr = tableb.acct_nbr , tablea.lnhist_appl_code = tableb.appl_code

ruby on rails - How to store ObjectID in MongoDb without references? -

i have 3 models: class user include mongoid::document field :name, :type => string has_many :comments embeds_many :posts end class post include mongoid::document field :title, :type => string field :body, :type => string embeds_many :comments belongs_to :user end class comment include mongoid::document field :text, :type => string belongs_to :user embedded_in :post end and have error: referencing a(n) comment document user document via relational association not allowed since comment embedded. ok, thats right. how can store, wrote comment? the belongs_to user in comment what's throwing off. use normal field store foreign key. class comment include mongoid::document embedded_in :post field :text, :type => string field :commenter_id end

Error Writing a Copy constructor in C++ -

i trying write copy constructor class these 2 error messages, cannot decipher. can please tell me doing incorrect? class critter { public: critter(){} explicit critter(int hungerlevelparam):hungerlevel(hungerlevelparam){} int gethungerlevel(){return hungerlevel;} // copy constructors explicit critter(const critter& rhs); const critter& operator=(const critter& rhs); private: int hungerlevel; }; critter::critter(const critter& rhs) { *this = rhs; } const critter& critter::operator=(const critter& rhs) { if(this != &rhs) { this->hungerlevel = rhs.gethungerlevel(); // error: object has type qualifier not compatible member function } return *this; } int _tmain(int argc, _tchar* argv[]) { critter acritter2(10); critter acritter3 = acritter2; // error : no suitable copy constructor critter acritter4(acritter3); ...

java - adding frames to mainFrame -

i want add frame main frame, lets we've 3 frames (frame1, frame2, , frame3) want to: create new frame called frame 4 , add menu bar items (view frame1, view frame2, view frame3) --> i've created frame successfully. when click on view frame1 want display frame1 in place in frame4 , on menuitems my problem i've created old frames using drag-and-drop tech. in net beans there component called internalframe when tried use couldn't add old frame internal one. you can solve problems reading this great tutorial on creating mdi applications in java using netbeans.

Matlab .net interop class hierarchy issue -

as matlab weak-typed language while c# strong-type language, interop not natural intent be, thereby have little trouble in hope can advice on here. in case, want call 1 .net library in matlab. .net library has lots of oo structures. intention not want change c# library side. add relative assembly matlab. for instance, in .net library, have class { method1 //not static method } class b : { ... } in matlab code, retrieve 1 object of class b, e.g b , want invoke object's class a's method1. natural coding behavior calling: b.method1(val); . however, matlab give me below error makes me unhappy: error: no method 'method1' matching signature found class b i might post of study on issue: i not oo programming in matlab side, oo classes reside in dll only. , not want change dll part well. i saw posts 1 can call superclass's method through subclass's class as: func@superclass(val) . not apply case assume. i saw posts on driver between mongo-...

.net - Can I make a rich text box display control pictures? -

Image
i'm trying display control pictures in rich text box. need textbox remain monospaced. when copy-paste said characters visual studio, appear monospaced , fine. when being displayed in rich text box, they're squares. both ide , text box using consolas. i see in ide (the last 2 characters equivalent): richtextbox.text = new string(new[] {'→', '␣', '␂', '\u2402'}); but text box display first 2 characters, 2 boxes: how can full character picture display? there few fonts in windows contain large number of oddball characters unicode character set. when paste 1 of control characters word, converts arial unicode ms font appears backup characters aren't available in font. try setting font in rich edit arial unicode ms before insert character.

sublimetext - Has anyone come up with a fix line continuation (Python-style) in Sublime Text 2? -

the issue referring indentation behavior of lists , other things in python when on 2 lines. result looking sublime automatically indent example, making code little prettier: def testmethod(argument1, argument2, argument3, argument4): pass but in sublime, when press enter after line 1, , type remaining arguments, happens: def testmethod(argument1, argument2, argument3, argument4): pass obviously, isn't readable (and uncompliant pep 8 style conventions). googled around , found few unresolved threads, no solutions. running latest version of sublime text 2, on mac. appreciated. this can (partially) fixed adding: "indent_to_bracket": true to packages/user/preferences.sublime-settings file (linux). unfortunetly seems work () , , not {}[] .

validation - Zend_Validate_Between on Another Value -

what best way validate number range based on value of form element? if user selects "percentage" discount type, discount amount should between 0 , 100, , not 140! problem seems passing in form element value. also, i've viewed other resources, 1 dealing similar topic, perhaps not way relevant. how validate field of zend_form based on value of field? form.php $isvalid = new application_model_validate(); $discount = $this->createelement('text', 'discount') ->setlabel('discount amount') ->setdescription("enter amount in format \"200.00\" ") ->setrequired(true) ->setdecorators(array('description', 'viewhelper', 'errors', array('htmltag', array('tag' => 'dd')), array('label', array('tag' => 'dt')))); $discount-...

regex - Regular Expression to match two strings in AND condition -

i new regular expression, please kindly me on error scenario need use regex match 2 error messages (appearing in different lines, same paragraph) in , condition log file: msg1 - error [com.company.util.ejb.timedbean] () failed processing loader msg2 - java.lang.runtimeexception: message code:[sl] unknown. basically, need match (msg1)&&(msg2) , in case, (error...loader) appear in first line , (java...unknown) follow in next line. messages follow order. not programming in typical language here, put enterprise tool accepts regexp. if possible, show me how make in or condition (msg1)||(msg2) ? matching 2 consecutive lines is, in theory, matter of putting 2 regular expressions end-to-end. purposes of illustration, let's you've got file named logfile.txt contains messages you're looking for. linux command line this: pcregrep -m -o '^error\n*loader$\njava\n*unknown\.$\n' logfile.txt and print line pairs you're looking for. breaking ...

python - Can we run multiple functions each with timeit in the same module -

i write multiple functions in same python module, each of separate profiling test using timeit , can use command line argument specify 1 run. naive example (profiling.py) be: import sys import timeit def foo(): setup = """ import random """ foo_1 = """ in range(1000): random.randint(0, 99) + random.randint(0, 99) """ foo_2 = """ in range(1000): random.randint(0, 99) + random.randint(0, 99) """ foo_3 = """ in range(1000): random.randint(0, 99) + random.randint(0, 99) """ print 'foo_1', timeit.timer(foo_1, setup).timeit(1000) print 'foo_2', timeit.timer(foo_2, setup).timeit(1000) print 'foo_3', timeit.timer(foo_3, setup).timeit(1000) if __name__ == '__main__': if (len(sys.argv) > 1): if (sys.argv[1] == 'foo'): ...

javascript - Cancel default onbefoarunload pop up message inside method -

i have following code, question that, there way can cancel onbeforeunload custom pop inside method call? in case of firefox want show own custom message , if user pressed cancel dont want show default message. <!doctype html> <html> <head> <script type="text/javascript"> var clicked = false; function copytext() { var span = document.getelementbyid('sp'); if(clicked == false) { clicked = true; span.appendchild( document.createtextnode("clicked") ); } else { clicked = false; span.removechild( span.firstchild ); } } window.onbeforeunload = function () { if(clicked == true) return ; else { if(navigator.useragent.indexof("firefox")!=-1) { if(confirm("are sure want close window without submitting documents?")){ self.close(); return; // want not call custom pop here } } return "are sure want close window withou...

SQL SERVER AND HIBERNATE UPDATE DDL ISSUE -

i've been on problems hibernate ddl update tool , sql server. first of explain our application ddl update works on mysql, postgres or oracle. let me explain happens: we created in sqlserver users access same databases, in different schemas, example: users: user1, user2, user3 user1 connects schema1 user2 connects schema2 user3 connects schema3 the permissions granted these users are: db_datareader, db_datawriter, dbowner, public it works sometimes, doesn't have guys ever experienced problem this?

java - JavaFX style class won't refresh -

i'm adding style class node if it's selected , remove if select other item. if remove style class style wont refresh wont go normal state: admin_category_label.getstyleclass().remove(admin_category_label.getstyleclass().indexof("selected")); admin_category_label.getstyleclass().add("clear"); but style stay same class selected this bug. reported here removal of hovered style class, not update styling . may want vote , watch it. workaround should override css rules touched/changed same default ones. demo: import javafx.application.application; import javafx.event.actionevent; import javafx.event.eventhandler; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.control.label; import javafx.scene.layout.stackpane; import javafx.scene.layout.vboxbuilder; import javafx.stage.stage; public class styledemo extends application { @override public void start(stage primarystage) { final label lbl = new ...

ajax - Grails - Select box tied to object ID and remote field -

run bit of odd problem increasingly frustrating scenario: have list of domain objects, each has g:select attached rendered remote field. how tie status variable or personinstance id selection box, when use renderfield, update testdiv_(number) view: <g:each in="${listofpeople}" status="i" var="personinstance"> <td> text: <g:remotefield action="getresults" controller="person" id="" update="testdiv_${personinstance.id}" paramname="search" name="getresults" value="" /> <g:each in ="${personinstance?.choices}" var="choice" status="x"> <li>${choice}</li> </g:each> </td> <td> <g:render template="renderthistemplate"></g:render> </td> </g:each> template: <div id="testdiv_${personinstance.id}" class="testdiv_${personinstance...

Python/Tkinter root window background configuration -

Image
i'm trying create root window black background blend button backgrounds. i have following: class application(frame): def __init__(self, parent): frame.__init__(self, parent) self.parent = parent self.initui() ... def initui(self): self.outputbox = text(bg='black', fg='green', relief=sunken, yscrollcommand='true') self.outputbox.pack(fill='both', expand=true) self.button1 = button(self, text='button1', width=40, bg ='black', fg='green', activebackground='black', activeforeground='green') self.button1.pack(side=right, padx=5, pady=5) self.button2 = button(self, text='button2', width=20, bg='black', fg='green', activebackground='black', activeforeground='green') self.button2.pack(side=left, padx=5, pady=5) ... def main(): root = tk() root.geometry('1100x350+500+300') ...

Place link inside Jquery -

i using code found on jsfiddle http://jsfiddle.net/mekwall/fnyhs/ since seems best situation need dynamical text fit container (by changing font size). (function($) { $.fn.textfill = function(maxfontsize, maxwords) { maxfontsize = parseint(maxfontsize, 10); maxwords = parseint(maxwords, 10) || 4; return this.each(function(){ var self = $(this), orgtext = self.text(), fontsize = parseint(self.css("fontsize"), 10), lineheight = parseint(self.css("lineheight"), 10), maxheight = self.height(), maxwidth = self.width(), words = self.text().split(" "); function calcsize(text) { var ourtext = $("<span class='dyntextval'><a href='#' class='trigger'>"+text+"</a></span>").appendto(self), multiplier = maxwidth/ourtext.width(), newsize = fontsize*(multi...

ember.js - Ember-data bootstrapping model objects -

when bootstrapping ember-data model objects existing json not remote ajax call, have make following 2 calls: app.store.load(app.account, data); var account = app.store.find(app.account, data.id); is not possible create object in 1 step, similar calling setproperties on existing ember object? also, how work creating collection of ember model objects? example: var users = app.get('users'); app.store.loadmany(app.user, users); this.set('content', app.store.findmany(app.user, users.mapproperty('id').uniq())); the above seems wrong. how can create these objects existing json objects? seems ok me, store.load* returns else model objects (loaded ids & clientids ). so far, think there no alternative.

database - Modifying MySQL table -

how modify mysql table hundreds of records being inserted every second without having downtime / losing data or errors . ex: adding new field thanks gut feel says should avoid modifying table. alternative add column new table , link original table maintain referential integrity, original table remains untouched. another, typical approach create new table added column, swap out old table , add data new table. not great solution though. mysql gurus disagree me.

ruby - Creating folder structure using high_voltage gem in Rails -

i'm trying use high_voltage gem serve static pages in rails app. want individual sections own folder, can't quite work & can't find solution around web. what want: rails_root/app/views/pages/(page) routed '/(page)' while rails_root/app/views/pages/(directory)/(page) => '/(directory)/(page)' here's attempt: routes.rb: cam4::application.routes.draw root :to => 'high_voltage/pages#show', :id => 'index' match '/:id' => 'high_voltage/pages#show', :as => :static, :via => :get scope "ruby" match '/ruby/:id' => 'high_voltage/pages/ruby#show', :as => :static, :via => :get end end thanks lot, cameron actually ended solving problem on own using route globbing. given rails 3.2.5 app running high_voltage, view paths: rails_root/app/views/pages/id [=> '/pages/id' or '/id'] rails_root/app/views/pages/ruby/id [=...

bash - How do I selectively create symbolic links to specific files in another directory in LINUX? -

i'm not sure how go doing this, need create symbolic links files in 1 directory , place symbolic links in directory. for instance, want link files word "foo" in name in current directory bar1 not have extension ".cc" , place symbolic links in directory bar2. i wondering if there single line command accomplish in linux bash. assuming in directory contains directories bar1 , bar2 : find bar1 -name '*foo*' -not -type d -not -name '*.cc' -exec ln -s $pwd/'{}' bar2/ \;

iphone - AVCaptureSession fails when returning from background -

i have camera preview window working 90% of time. however, when returning app if it's been in background, preview not display. code call when view loads: - (void) startcamera { session = [[avcapturesession alloc] init]; session.sessionpreset = avcapturesessionpresetphoto; avcapturevideopreviewlayer *capturevideopreviewlayer = [[avcapturevideopreviewlayer alloc] initwithsession:session]; capturevideopreviewlayer.frame = _cameraview.bounds; [_cameraview.layer addsublayer:capturevideopreviewlayer]; capturevideopreviewlayer.videogravity = avlayervideogravityresizeaspectfill; capturevideopreviewlayer.position=cgpointmake(cgrectgetmidx(_cameraview.bounds), 160); avcapturedevice *device = [avcapturedevice defaultdevicewithmediatype:avmediatypevideo]; nserror *error = nil; avcapturedeviceinput *input = [avcapturedeviceinput deviceinputwithdevice:device error:&error]; if (!input) { nslog(@"error: %@", error); uialertview *alert = [[uialertview alloc] ini...

windows - Using DebugDiag with an in-house application -

Image
how use debugdiag in-house application? what need (include obj file, link assembly, etc) debugdiag analysis requires symbols (by default microsoft public symbol server configured debugdiag). downloaded microsoft public symbols places in “c:\symcache” if have in-house app, , have symbols, can add pdb files (only) symbol path: “c:\symcache” during debugging, if setting breakpoints, need symbols added appropriate path. “c:\symcache”

c# - Refresh datagridview win forms after updating the database from a child form -

how refresh datagridview after making changes on database form, after closing child form tried refresh datagridview click event it's not working, have use dataset ? //create oledbdataadapter execute query dadapter = new oledbdataadapter(gquery, connstring); //create command builder cbuilder = new oledbcommandbuilder(dadapter); //create datatable hold query results dtable = new datatable(); //fill datatable dadapter.fill(dtable); //bindingsource sync datatable , datagridview bsource = new bindingsource(); //set bindingsource datasource bsource.datasource = dtable; //set datagridview datasource datagridview1.datasource = bsource; private void button_refresh_click(object sender, eventargs e) { datagridview1.datasource = bsource; datagridview1.refresh(); } help me, please ...

facebook graph api get /me/scores does not work for all users -

i have following permissions. 'user_games_activity, user_likes, friends_games_activity, read_friendlists' i want access score of castleville game of friend's plays it. doing right now. getting friends list. '/user/friends'. getting user scores of games friend '/friend_id/scores' checking if castleville game id exists in scores array , extracting score. here's problem in step 2. '/friend_id/score's not return data users. shows friends array blank. should show games or atleast game user plays. tested 1 of friends id plays dozens of games, on timeline scores shown no data '/scores' api query. working friends id. checked privacy settings & app permissions both users , same. i think missing something. ideas! edit: problem may solved. changed category of app games , can access scores of friends (tested few , showed). although people clicking on play game in auth dialog box whereas app not game. according specifica...

android - Home button and back to app in a newly installed app loads the initial activity again -

i'm encountering following scenario in application: installing , opening (using open button after installation, instead of icon in applications list). navigating through few activities. clicking home button. clicking application icon load again. instead of returning activity in, initial activity loaded. previous activity still there , can accessed clicking button, there isn't way know , looks app restarted. this may issue in app, because in cases might require registration after performing few actions, , losing focus on activity annoying is there can done avoid that? there's couple of flags under intent might helpful. use them when activity launched: " flag_activity_task_on_home : if set in intent passed context.startactivity(), flag cause newly launching task placed on top of current home activity task (if there one). flag_activity_reorder_to_front : if set in intent passed context.startactivity(), flag cause launched activity brought fro...

How to get username in vi/vim editor? -

i trying find username/fullname of current user invoked vi/vim editor. :autocmd bufnewfile *.sh exe "1," . 10 . "g/author :.*/s//author : " .getlogin() i tried using getlogin(), getuser(), getpwnam() nothing worked. you can use $user variable: :echo "your username is" $user

c# - Linq average, parameter function -

@foreach (var item in model) { @html.actionlink(item.rates.average(item => item.rate)), "showrates", "track", new { track_nr = @item.track_nr, album_id=@item.album_id}, null) <br> } i trying show average of rates, rates table in database consists of integers in collumn rate. visual studio telling me have give function parameter. have no idea how create function? adding these functions view make ugly, rather add aproperty of model , calculation in controller before sending data view. public class albumviewmodel { public int album_id { set;get;} public string track_nr { set;get;} public decimal average_rate{ set;get;} } your action method public actionresult getalbums() { var albums=rep.getalbmums(); foreach(var album in albums) { album.average_rate=album.rates.average(); } return view(albums); } and in clean view, @foreach (var item in model) { @html.actionlink(item.average_rate, "sho...

ios - What is the situation regarding the NSURLConnection timeout with iOS5? -

i'm trying find definitive answer if possible set timeout value using nsurlconnection in ios 5 (i set 30 seconds). i've searched past postings on information seems contradictory. example, posting nsurlconnection timeout? says apple mandates 4 minute minimum timeout - though cannot find apple documentation support this. this posting says 240 limit comes apple forum thread nsmutableurlrequest not obeying timeoutinterval they limit posts when body isn't empty. imply possible set timeout less 4 minutes gets? somebody commented here that's not case ios 5, down voted nsmutableurlrequest not obeying timeoutinterval and there's other's saying other things anyway of previous postings on topic seem couple of years ago prior ios 5. if there 4 minute limit having rely on hearsay know bit ridiculous if there no apple documentation. does know actual definitive situation on ios 5. it not connection has associated timeout, request (that made on co...

iphone - Difference between _property and self.property -

i'm confused proper conventions when dealing properties. i'll illustrate question through example. example below know functionally "self.loan = self.loan + 250.00;" same "_loan = _loan + 250.00;" or not? see numerous tutorials on web may or may not use both methods access property. difference between using _loan , self.loan (i know self.loan same [self setloan:]) //classa.h @interface classa: uiviewcontroller @property double loan; @end //classa.m @implementation classa @synthesize loan = _loan; -(void)dosomething{ self.loan = self.loan + 250.00; //exhibit _loan = _loan + 250.00; // exhibit b } _loan variable , assigning value has no particular side effect. self.loan = self.loan + 250.00 same writing [self setloan:[self loan] + 250.00] in methods called may other things set or value of variable. things methods depend on whether write custom versions of them (the setters , getters) or use @synthesize create them and, if use @synt...

file upload - ABAP Webdynpro fileupload -

i'm searching webdynpro abap-code snippet uploaded file(xstring) bds (business document service) system of sap. i'm using "file upload" function of webdynpro. i've tried insert file bds-function "create_with_as_table" rubbish stored in bds. of files in binary format or zip files. can me solve little problem? thanks hi answer. i found solution of little problem. forgot convert xsting in binary format insert file in bds system. unfortunatly many guys have same problem nobody posted snippet. the important code is: call function 'scms_xstring_to_binary' exporting buffer = im_xstr importing output_length = lv_size tables binary_tab = lt_data. my complete class: method wd_save_new_file. data: i_files type sbdst_files, wa_files line of i_files, i_signature type sbdst_signature, wa_signature line of i_signature. * prepare data fm - components data: i_components type sbdst_components, ...

jquery - How to group dynamically generated content based on similar content -

i have dynamically generated page varying number of items (div.item). each item has inner div class "date". items ordered ascending order db based on date value. since page content taken db there may 10 items same date, next 3 share date, next x may share date, , on. based on content of div.date want wrap items similar dates in div.group. have preferred doing direct on php code, i've inherited large messy project no documentation , option temporary. current simplified structure below: <div class="item"> <div class="date">04-06-2012</div> <div class="other-content">other content</div> </div> <div class="item"> // grouped above <div class="date">04-06-2012</div> <div class="other-content">other content</div> </div> ... <div class="item"> // in it's own group <div class="date">08-06-2012<...

How to add a TIFF image to the bottom of another one in C#? -

i scan two-sided image twain , gets me array of pictures , can save them separately. need combine these 2 images side-by-side , save single tiff file. could please tell me how open tiff images , save them single file contains both of them side side? are writing own app based on twain specification? if yes, can use twff_tiffmulti multi-page tiff file.

debugging - Quick Reference for LLDB? -

i'm familiar single- , double-page quick reference "cards" gdb, , have found them quite useful. now our project using lldb i'd find equivalent tool, i've had little luck finding 1 have expected. does 1 exist? perhaps lldb gdb command map ? need reformatted if want in reference card style layout, it's written one.

java - GWT environment errors within ScheduledThreadPoolExecutor threads -

i trying write server-side component of gwt application should pull xml file every 3 minutes , keep hashtable date after parsing xml. after research, set thread using scheduledthreadpoolexecutor stationparser = new tflstationsparserthread(bikestations); scheduler.schedulewithfixeddelay(stationparser, 2, 180, seconds); the tflstationsparserthread has minimal constructor, , run() method public void run() { system.out.println("tflstationsparserthread run()"); stationparser.refreshstationdata(stations); } the stationparser gets data following command httpresponse response = urlfetchservicefactory.geturlfetchservice().fetch(request); here problem: when .fetch() run within scheduledthreadpoolexecutor following error com.google.apphosting.api.apiproxy$callnotfoundexception: api package 'urlfetch' or call 'fetch()' not found. @ com.google.apphosting.api.apiproxy.makesynccall(apiproxy.java:98) @ com.google.appengine.api.urlfetch.url...

iphone - How to detect both main view UILongPressGestureRecognizer and subview UIPanGestureRecognizer -

i encountered problem uilongpressgesturerecognizer , uipangesturerecognizer. i wish long press in self.view add view uipangesturerecognizer in self.view. however uipangesturerecognizer not recognizing. did missed ? - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. //[self initimagesandgesture]; uilongpressgesturerecognizer *taprecognizer = [[uilongpressgesturerecognizer alloc] initwithtarget:self action:@selector(addimgview:)]; taprecognizer.numberoftouchesrequired = 1; taprecognizer.minimumpressduration = 0.7; [taprecognizer setdelegate:self]; self.view.userinteractionenabled = yes; [self.view addgesturerecognizer:taprecognizer]; } -(void)addimgview:(uilongpressgesturerecognizer *)recognizer { nslog(@"tappppp"); if(uigesturerecognizerstatebegan == recognizer.state) { // called on start of gesture, work here nslog(@"uigesturerecognizerstatebegan...

integrating python scripts with django -

i have written test scripts in python call apis paritcular application , output results database can use jasper report on results. scripts run using python interpreter, ie double click on python file has parameters , variables modifed within script initiates tests. move towards more user friendly interface other people can use these test scripts without having modify python code. thinking using django , creating web page has check boxes, , if check box ticked, execute particular python test script or text box pass values given variable, example. have few questions around how might achieved. 1 - need implement python code in django source code or can call python script web page served django? 2 - if run web page, how ensure if web page closed, test continue in background. 3 - there way output status of test case web page , if web page closed, status availble if web page reopened? many - oli if have python function can call django django view maybe form parameter inp...

splunk - regex to match some string -

i working project need match string in output.. here sample: user code timestamp action name s#tplc field name user code group profile snglask 2012-05-30-20.33.53.003000 insert user test5 display snglask 2012-05-23-22.06.44.422000 change password rso part u lerapr sngchis full_auth snglask 2012-05-30-20.34.39.066000 insert user group profil *none basically have application need understand each row after space belong next column. then, after action name can treated other. hence, have come out regex format below: regex = ^([^\s]+)\s+([^\s]+)\s+([^\s]+)s(.*)$ format = usercode::"$1" timestamp::"$2" actionname::"$3" others::"$4" the strategy recognize string ignore space after that. however, thing work until action name might space between action name. hence, problem is, how use regex le...

Calling a method from another viewcontroller in objective c -

i have controller (name : parent.m) extending uiviewcontroller add view (controller (name: child.m) ) has table view in it. on click of 1 of rows on table of child.m, want invoke method in parent.m class. not want create new instance of parent.m. could explain how can accomplish this. need define protocol between two? if can explain me how. if you're using uinavigationcontroller, can hands on parent view controller doing in child view controller. parentviewcontroller * parentview = (parentviewcontroller *)[self.navigationcontroller.viewcontrollers lastobject]; if not using uinavigationcontroller, use notifications (may overkill). or key value observing parent child (i.e. change display or value of based on change in child view controller). or, straightforward thing here set parent delegate target of child. 1 ) in childviewcontroller.h file, create protocol looks this: @protocol childviewdelegate - (void) dosomethingwith: (nsstring *) thisstring; @en...