Posts

Showing posts from March, 2014

Sync My Timesheets to QuickBooks in Rails App -

i have rails application, employees creating weekly time sheets, want upload weekly time sheets on quick books using rails app. how can in ror ? thank you, create account on https://developer.intuit.com create app , sandbox after logging in. hook rails talk sandbox. see my tutorials these 3 steps. timeactivity supported quickbooks-ruby gem check docs , specs implementation. you need implement employee or vendor entity reference required sync timeactivity. when ready production enable within app @ https://developer.intuit.com , follow steps similar 1-3 configure.

c# - Mapping Data Annotation of a Model object to Custom Class object .net mvc -

i'm wondering how map model object more generic class object , saving values of dataannotation specified field. my example model example. want map 1 model object 1 fieldsetmodel object, contain list of model fields value, , alla metadata provided dataannotation. model.name -> fieldset.formmodel[1].id model.name ->fieldset.formmodel[1].name model.(dataannotation(maxlenght) -> fieldset.formmodel[1].maxlenght model.(dataannotation(display) -> fieldset.formmodel[1].displayname etc.. model public virtual int32 id { get; protected set; } #region login [required,maxlength(30)] [display(name = "nome utente")] public virtual string username { get; set; } [required, maxlength(200),datatype(datatype.emailaddress)] [display(name = "email")] public virtual string email { get; set; } [required] [display(name = "password"),datatype(datatype.password),minlength(6)] [stringlength(100, errormes

c# - Showing PDF in PopUp -

i using asp.net mvc , want show pdf in jquery dialog or inside boostrap modal popup. i tried ajax call if controller action returning file return file(....) giving wrong output in popup. if use iframe when specifying url inside iframe redirecting httpget controller action want redirect httppost controller action(because have post form also). actually why want open pdf inside popup or iframe because right pdf opening in same window want open in new browser tab or inside popup or inside iframe visitor continue use website without pressing browser button. i stuck this..plz help..!!!! you can use request iframe , right way it. if create pdf post request need return kind of file id or file name. , in iframe file using id or file name. post request creating pdf returns id or filename get request /path/to/your/pdf_files/<filename>.pdf in iframe. update: if want display small files (this method not recommended big files) come previous post request without

How to Read a particular Data from XML file and Write it to an Existing Excel Sheet using c# -

i have xml file, have values good, , bad, tag quality. want read xml file , print ones bad, in excel sheet existing. can me please. xml file looks same below. in text want write entire hydr. instrument id, hydr.quality" bad values in hydr.quality element. <hydr.instrument id="abr"> <hydr.quality>good</hydr.quality> <hydr.value>0</hydr.value> </hydr.instrument> <hydr.instrument id="abr_dummy"> <hydr.quality>bad</hydr.quality> <hydr.value>0</hydr.value> </hydr.instrument> <hydr.instrument id="abr_loop_jp"> <hydr.quality>good</hydr.quality> <hydr.value>15.208 kg/cm2g</hydr.value> </hydr.instrument> <hydr.instrument id="abr_mov_12"> <hydr.quality>good</hydr.quality> <hydr.value>0</hydr.value> </hydr.instrument> bas

javascript - Where to put the script to appear under scripts menu in Illustrator cs5.1 -

i have script illustrator cs5.1 part of scripts menu. i've tried put under: c:\program files\adobe\adobe illustrator cs5.1\presets\en_gb\scripts\ c:\program files\adobe\adobe illustrator cs5.1\presets\en_gb\scripts\myfolder c:\program files\adobe\adobe illustrator cs5.1\presets\ c:\program files\adobe\adobe illustrator cs5.1\presets\myfolder but of attempts failed, have restarted illustrator, can wrong? windows 7 . i don't know why, solution not use *.jsx *.js script extension. when i've changed js , placed c:\program files\adobe\adobe illustrator cs5.1\presets\en_gb\scripts\ appeared under scripts menu. with 64bit cs6 illustrator path looks this: c:\program files\adobe\adobe illustrator cs6 (64 bit)\presets\en_gb\scripts and accepts jsx or js extensions.

QDateEdit return to previous state on button click in Qt C++ -

i have qdateedit in form in qt , want on button click qdateedit returns previous state. how can done? at moment state of qdateedit (which specialized qdatetimeedit ) can retrieved calling date() method . then, said, need put value qdate variable of class , create slot connect button click , calls setdate set qdateedit date. below code snippet shows 1 way this. #ifndef mydialog_h #define mydialog_h #include <qdialog> #include <qhboxlayout> #include <qdateedit> #include <qpushbutton> class dialog: public qdialog { q_object public: dialog(qwidget *parent = 0) : qdialog(parent), layout(this), edit(), button("reset",this) { layout.addwidget(&edit); layout.addwidget(&button); date = edit.date(); connect(&button, signal( clicked() ), this, slot( resettime() ) ); } public slots: void resettime() { edit.setdate(date); } private: qhboxlayou

yii url manager - Yii urlManager rule parametr with slash -

i have controller categorycontroller should process url kind of http://example.com/category/param/paramnext/paramsome... my config includes next code: 'urlmanager'=>array( 'urlformat'=>'path', 'rules'=>array( 'category/<name:[\w\/]+>'=>'category/view', '<controller:\w+>/<id:\d+>'=>'<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>', '<controller:\w+>/<action:\w+>'=>'<controller>/<action>', ), 'showscriptname'=>false, ), but not works! error 404 system unable find requested action "param". how can resolve restriction? i have kind of $name string "param/paramnext/paramsome..." &#

ios - How to change the color of the UISearchBar Icon? -

Image
i don't know how modify original searchicon 's color. you can use custom image of white search icon, search bar not modify supplied image. set custom image, use method. ( link documentation. ) - (void)setimage:(uiimage *)iconimage forsearchbaricon:(uisearchbaricon)icon state:(uicontrolstate)state; example code: [searchbar setimage:[uiimage imagenamed:@"searchicon"] forsearchbaricon:uisearchbariconsearch state:uicontrolstatenormal]; in swift: searchbar.setimage(uiimage(named: "searchicon"), for: .search, state: .normal)

java - Error in maven-plugin : "Parameter 'directory' is not a directory" -

i using 2 maven modules of same project. 1 create maven plugin, files extension "myextn" of specified directory. i using org.apache.commons.io.fileutils files. my sample code here: file specificationdirectory = new file(system.getproperty("user.dir")+file.separator+src"+file.separator+"test"+file.separator); string[] extension = new string[] { "myextn" }; list<file> files = (list<file>) fileutils.listfiles(specificationdirectory, extension, true); another module have directory , files, , uses plugin. getting desired result if files , directory available in plugin module, not getting result when have files in second module, uses plugin. when trying run second module, getting following error , "parameter 'directory' not directory" my objective simple, have files in directory (secondproject/src/test) within second module, want list down files in directory using plugin has logic this. can please

Android Video Calling feature using wifi -

can me how implement video calling using wifi feature? have tried intent not working.please me out. intent callintent = new intent("com.android.phone.videocall"); callintent.putextra("videocall", true); callintent.addflags(intent.flag_activity_new_task); callintent.setdata(uri.parse("tel:" + "+919167903192")); startactivity(callintent); video calling skype requires using sip protocol. thing, there android.net.sip . bad thing, supports voip out of box. what's way out? need use sip library jain sip or csipsimple work done. need sip provider. can either become 1 or use existing 1 getonsip . my point being? not easy using intent. have manual coding.

visual studio 2013 - How to add libraries to dll project in VS2013? -

i've got code in c++ built libraries vtk, fltk, pcl , kinect sdk in visual studio 2010. task taking project , integrate c#.net project visual studio 2013. i told new project dlls , copy code need there make wrap. current problem not know how add references code can find includes libraries , compile. have tried add .h , .lib manually not work. may give me hint? thank you. i'm not entirely clear question is, try this: right click on project in solution explorer , go properties -> configuration properties -> linker -> input. in additional dependencies field, add .lib file(s). remember #include corresponding header files in source file.

Swift equal function dont work -

i want check equality between objects error. error within code. class test { var key: string init(nameparam: string) { self.key = nameparam } func ==(other: test) -> bool { return other.key == self.key } } var t1 = test(nameparam: "test") var t2 = test(nameparam: "test1") if(t1 == t2) { // error: 'test' not convertible 'mirrordisposition' println("...") } operators must implemented in global scope, not inside class. should implement equality operator outside of class: class test {...} func == (lhs: test, rhs: test) -> bool { return lhs.key == rhs.key } suggested reading: operator functions

java - How to get the output stream from a thread -

i have several runnable classes, each printing string upon completion using system.out.println() . in main() execute them using executorservice , executor.execute() each of them. i wondering after executing threads, how output stream them future use ? pretty using .getinputstream processes there's no such method in thread class. thanks! there's class implements runnable interface this: public class implements runnable { public void run() { system.out.println(5); //this thread print out number 5 } } and in main function need printed number , store it public static void main(string[] args) { executorservice threadpool = executors.newfixedthreadpool(1); threadpool.execute(new a()); //this statement cause thread object //to print out number 5 on screen threadpool.shutdown(); ...... } now need printed number 5 , store into, integer variable. i think below code satisfy re

VB.net read XML element -

i trying write application in vb.net stuck , spend time searching how can't it. need read specific xml element , write in specific label. if can give me example. i need output this: --book 1--- title: everyday italian author: giada de laurentiis --book 2-- title: harry potter author: j k. rowling --etc-- xml: <bookstore> <book> <title>everyday italian</title> <author>giada de laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book> <title>harry potter</title> <author>j k. rowling</author> <year>2005</year> <price>29.99</price> </book> <book> <title>xquery kick start</title> <author>james mcgovern</author> <year>2003</year> <price>49.99</price> </book> <book> <title>learning xml</title> <author

database - Unicode conversation in SQL Server Express 2012 -

i having trouble unicode. here stored procedure alter procedure [dbo].[spinsertreminder] @userid nvarchar(50), @remindertext nvarchar(250), @createdate nvarchar(50) begin insert [095_user_reminder] (userid, "remindertext", createdate) values (@userid, @remindertext, @createdate) end i try insert database "azərbaycan" . insert "az?rbaycan". how can resolve this? thanks...

ruby - ActiveRecord saving: differences in Rails 3.2.19 and Rails 4.2.0 -

i have 2 identical projects: rails 3.2.19 , updated rails 4.2.0beta4. when try foo.create! in rails 3.2 , rails 4.2 see diffirent queries in rails console log. rails 3.2 output: insert `foos` (`created_at`, `updated_at`, `column_1`,`column_2`, ...) values ('2014-11-19 11:20:28.391649', '2014-11-19 11:20:28.391649', null, null, ...) rails 4.2 output: insert `foos` (`created_at`, `updated_at`) values ('2014-11-19 11:20:28.391649', 545662, '2014-11-19 11:20:28.391649') please explain why different rails versions execute different queries , why did so? this related strong parameters enabled default in 4.x version. taking example documentation: class peoplecontroller < actioncontroller::base # raise activemodel::forbiddenattributes exception because it's using mass assignment # without explicit permit step. def create person.create(params[:person]) end # pass flying colors long there's person key in paramet

asp.net mvc - Ordering items from a model in a list C# -

i'm new mvc 4 , i'm trying figure out how order list being created reading in model. here model code: public class files { [key] public int file_id { get; set; } public string original_file_name { get; set; } public string current_file_name { get; set; } public string description { get; set; } public string file_path { get; set; } public string file_type { get; set; } public string file_status { get; set; } public datetime expiry_date { get; set; } //public int uploaded_by { get; set; } //public datetime uploaded_on { get; set; } } public class filescontext : dbcontext { public dbset<files> files { get; set; } } here controller code creates list: return view(db.files.tolist()); lastly html writes screen: @foreach (var item in model) { <tr> <td> @html.displayfor(modelitem => item.original_file_name) </td> <td> @html.displayfor(modelitem => item.current

javascript - How to trigger css :hover event on PageLoad -

i developing application want open cover on pageload . opening on hover. want bring out page inside outside after opening cover. <div id="onw" class="envelope"> <p>from: <span>lorem</span></p> <p>to: <span>ipsum</span></p> </div> <div class="open"></div> <div id="onee" class="content"> <p>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> <p>lorem ipsum dolor sit amet</p> </div> css long copy here have copied code jsfiddle jsfiddle example :- http://jsfiddle.net/rushijogle/4vs0r6zx/ if dont agree question plz dont mark negative thanx in advance you should remove :hover state , make animation html-class. e.g. .open.animateit contains animation. in case can make

css selectors - How to target CSS class names that start with digit -

i have list class want apply top margin - seems syntax invalid css. don't think likes 1200mm-x-4700mm section. i cannot rename list class automatically generated. there way around allow me apply css styling? <li class="max-panel-size 1200mm-x-4700mm">...</li> li.max-panel-size.1200mm-x-4700mm { margin-top: 20px; } in html5, css class names can contain (and start with) character. however, in order target fancy css class names inside css files (or javascript functions) you need escape them . li.max-panel-size.\31 200mm-x-4700mm { background: #f00; } li.max-panel-size.\31 111mm-x-1111mm { background: #0f0; } li.max-panel-size.\39 999mm-x-9999mm { background: #00f; } <ul> <li class="max-panel-size 1200mm-x-4700mm">test 1</li> <li class="max-panel-size 1111mm-x-1111mm">test 2</li> <li class="max-panel-size 9999mm-x-9999mm">test 3</li> <

auto generate form name using css or javascript -

i trying auto generate ids on page, dont know how possible is. e.g <form action="<?php echo $editformaction; ?>" method="post" name="" id=""> </form> i have searched internet , came acrossand got this h1 { counter-reset: section; } for displaying numbers on every h1 elements so intention every form added page id appended it. i know might sound weird rili need on this

android - Please somebody tell me how to create a bitmap out of this? -

im building app, makes possible , download image files. im receiving inputstream server when ask image files. if call method after uploaded picture without closing app first, possible decode stream bitmap , works fine. but if close first, doesn't work , content looks different. string looks "{"attachment":"/9j/4s5rxhp....." bufferedreader streamreader = new bufferedreader(new inputstreamreader(inputstream, "utf-8")); stringbuilder responsestrbuilder = new stringbuilder(); string inputstr; while ((inputstr = streamreader.readline()) != null) responsestrbuilder.append(inputstr); jsonobject att = new jsonobject(responsestrbuilder.tostring()); byte[] bytes = base64.decode(att.getstring("attachment"), base64.default); bmp = bitmapfactory.decodebytearray(bytes, 0, bytes.length);

forms - Redirect to new page after PHP validation -

i new php , have been working on website contains form restaurant reservation. currently, have 1 file, contains both html , php code. form validated once user clicks submit, wondering how might possible redirect user new page, confirming reservation, if of information have entered form correct. basically process wish website perform: user fills out form if validation not complete display error messages, loop form user can correct fields if form validated send user confirmation page here necessary code reservations page: .... <?php $nameerr = $teleerr = $emailerr = $partyerr = $viperr = $reservationerr = $timeerr = ""; $name = $tele = $email = $party = $vip = $reservation = $time = ""; if ($_server["request_method"] == "post") { if (empty($_post["name"])) { $nameerr = "please enter full name"; } else { $name = test_input($_post["name"]); if (!preg_match(&quo

Using Foreman with Sidekiq, Neo4j and Ruby on Rails -

in rails project i'm using neo4j instead of activerecord. added sidekiq , foreman able start sidekiq , rails server @ same time. have in procfile: worker: bundle exec sidekiq web: rails server when enter "foreman start" i'm getting error: 14:39:29 worker.1 | lockclient[8447] can't wait on resource rwlock[schema(0), hash=754245282] since => lockclient[8447] <-[:held_by]- rwlock[schema(0), hash=754245282] <-[:waiting_for]- lockclient[8448] <-[:held_by]- rwlock[schema(0), hash=754245282] 14:39:29 worker.1 | /home/user/.rvm/gems/ruby-2.1.2/gems/neo4j-core-3.0.8/lib/neo4j-server/cypher_response.rb:163:in `raise_error' 14:39:29 worker.1 | /home/user/.rvm/gems/ruby-2.1.2/gems/neo4j-core-3.0.8/lib/neo4j-server/cypher_session.rb:210:in `_query_or_fail' 14:39:29 worker.1 | /home/user/.rvm/gems/ruby-2.1.2/gems/neo4j-core-3.0.8/lib/neo4j/label.rb:42:in `create_constraint' ... further stack trace if don't use foreman , instead start s

Elasticsearch and Spanish Accents -

i trying use elasticsearch index data research paper. i'am figthing accents. intance, if use: get /_analyze?tokenizer=standard&filter=asciifolding&text="boletínes de investigaciónes" get { "tokens": [ { "token": "bolet", "start_offset": 1, "end_offset": 6, "type": "<alphanum>", "position": 1 }, { "token": "nes", "start_offset": 7, "end_offset": 10, "type": "<alphanum>", "position": 2 }, { "token": "de", "start_offset": 11, "end_offset": 13, "type": "<alphanum>", "position": 3 }, { "token": "investigaci", &qu

crystal reports 2008 - Need values returned from previous month-end date -

can please guide me how done. i'm using crystal 2008. i want pull in data previous month-end , put in same row current month, there 2 figure columns: 1 month-end figures , other previous month-end figures. want this: month-end account figure prev month-end figure 1/31/2014 21a3233 11 2/28/2014 3285592 22 11 3/31/2014 64eg544 33 22 4/30/2014 e5vg96a 44 33 5/31/2014 poiue52 55 44 6/30/2014 8889947 66 55 7/31/2014 p645252 77 66 8/31/2014 05eu6ab 88 77 9/30/2014 888e658 99 88 how prev month-end figures based on month-end dates in first column? create formula @last day , write below code last day of previous month: dateserial(year({month-end }),month({month-end }),1)-1 now create 1 more formula @data data of last day of previous month: if ({month-end }=dateserial(year({month-end

Thinktecture identity server 3 Single Sign Out -

i hope 1 point me towards right direction. have setup identity server 3 on iis , 2 different mvc clients identity server. little confused single sign out. hoping achieve single sign out. when login, each client web site setup own aspnet session cookie. when logout 1 client, other client still retain session(because of own session cookie). how can achieve single sign out multiple applications different domains. the openid connect spec single sign-out hasn't yet been published/completed. it's still work in progress here: http://openid.net/specs/openid-connect-session-1_0.html identityserver support part of sign-out though. need make sign-out request op via end_session_endpoint url that's in metadata.

c# - ThreadAbortException when Task calls method in service reference -

i need call method in service reference name canceltransactionbyrefpos. method has following signature: int canceltransactionbyrefpos(long refpos, out string resultdescription); if method returns '0' cancel succeeded. if method returns value, method has called again. i have written cancel method calls canceltransactionbyrefpos. important call happens asynchronous because can take 30 seconds till response given. my method looks like: public void cancel(long refpos, giftcard giftcard, account_3_2 account) { var task = task.factory.startnew(() => { int result; { string resultdescription; result = _client.canceltransactionbyrefpos(refpos, out resultdescription); // logic log result giftcard , account parameter } while (result != 0); }); // task.wait(); // ######## uncomment -> code executes! ######## } when cancel task.wait()

php - How to set $variable as a DATE_FORMAT in MySQL -

i have created 1 variable changing date format in mysql query not working me there way use variable date-format in mysql query ? my code here <?php $con = mysql_connect(); mysql_select_db(); $dateformat = '%d-%m-%y'; $result = mysql_query("select *, date_format(2014-11-18, $dtformat) nicedate tablename;"); $data = array(); while ( $row = mysql_fetch_row($result, true) ) { $data[] = $row; } echo json_encode($data); ?> you need pass $dateformat instead of $dtformat string in mysql. <?php $con = mysql_connect(); mysql_select_db(); $dateformat = '%d-%m-%y'; $result = mysql_query("select *, date_format('2014-11-18', '".$dateformat."') nicedate tablename;"); $data = array(); while ( $row = mysql_fetch_row($result, true) ) { $data[] = $row; } echo json_encode($data); ?>

javascript - What is a constructor function's prototype? -

say, have constructor function called myclass . , create object obj out of it. obj inherits myclass.prototype . here question: where myclass.prototype from? plain object constructor property? thanks answers. // constructor function myclass() { } var obj = new myclass; // object inherits myclass.prototype obj.__proto__ == myclass.prototype; // => true // myclass.prototype inherits object.prototype myclass.prototype.__proto__ == object.prototype; // => true where myclass.prototype from? it's implicitly created when function object ( myclass ) created. is plain object constructor property? yes, exactly. no more that, no magic involved :-)

html - -webkit-overflow-scrolling: touch; not working on iPhone 6+ in Safari -

during testing on site developing, noticed -webkit-overflow-scrolling: touch; applied container of mobile menu not work expected on iphone 6+, working expected on iphone 5. after googling, found workaround said adding border same element fixes issue, , did briefly. once style added css , page refreshed, no longer worked until rotated phone, , rotated - leads me believe kind of bug safari on larger iphones. has else encountered issue? know solutions fix this? thank you! ios 8 not read -webkit-overflow-scrolling: touch should insert overflow:scroll fix problem on ios 8. in case versions before 8 read "-webkit-overflow-scrolling: touch" , 8th version read "overflow:scroll". i faced same problem , fixed in way.

jquery - How to access value in data-attributein an x-editable context? -

this code triggers display of form multiple fields (a postal address), inline editing. want values ( street_name , , more ) data attributes in triggering element. code below doesn't this. if put string "broadway" display. possible in params (see code). the documentation contains example of form multiple fields values hardcoded. using $(this).editable().attr('steet_name') doesn't work in value ( undefined not function ) how can values need data attributes of triggering element? edit - i'm using js several different triggering elements, can't set var street_name = $("#letteraddress").data('street_name'); $('.editable-address').editable({ url: '/en/ajax/methods?method=normalize-address', mode:'inline', // here $(this).attr() doesn't work value : { street_name: $(this).attr('data-street') }, // here, $(this).attr() work

java - Convert String containing letters to Int efficiently - Apache Spark -

i working dataset has users strings (ie. b000gkxy4s). convert each of these users int, can use rating(user: int, product: int, rating: double) class in apache spark als. efficient way this? preferably using spark scala functions or python native functions. if want matchable string int - string.hashcode() . have deal possible hash collisions. alternatively you'd have convert each character int value , append (not add) of these together.

Selenium IDE - Inconsistent Link Behaviour -

i've been working selenium ide , have test script, uses both 'click' , 'clickandwait' commands. when running script multiple times, these steps behaving inconsistently in way link opens. link opens in same window, expected site i'm testing on. link opens in new window when using exact same test case/step before, causing test case fail. has else encountered this? or know causing it? could browser settings, try looking option says firefox opening links in new tabs , make sure it's de-selected

memory leaks - navigating between pages Windows phone runtime -

let have 2 pages page1, , page2. when launch app, page 1 loading, can choose go page2. can go in page1. problem is, if page1->page2->page1 several times constructor of page2 called every time navigate on (i guess it's same page1), , more , more memory used. besides, if app suspended , resumed, resuming method called n-times page2 instantiated. so there way avoid please ? use page.navigationcachemode by default, each navigation creates new instance of specific page subclass requested, , disposes previous page instance. happens when navigating visited page or when new page type same previous page type. apps involve frequent navigation same pages can cache , reuse page instances make navigation more efficient. this, set cachesize property specify how many pages cache. each page type want cache, must set page.navigationcachemode property either enabled or required. pages required cache mode cached regardless of cachesize value, , not count

How do multiply a 64bits with 32 bits in MIPS -

im trying multiply 2 32bits in mips. result stored in high , low register. how can multiply 64bit 32 bit when answer stored in 2 registers? you multiply each half of 64-bit value 32-bit value, add matching registers together, realizing may need third 32-bit register represent result.

c# - Sharing Forms authentication between newer MVC and older VB.Net projects -

my company has old 3.5 webforms vb.net application needs share authentication newer framework 4.5.1 mvc5 c#.net application. the newer application based on popular default mvc5 template, using forms authentication, storing authentication tokens, understand it. the old vb application has no security currently, needs share in new application's authentication. have found numerous posts , articles touch on this, not extent can working example. i have configured web.config files both sites have identical (except defaulturl) authentication , machinekey segments; see snip below old vb.net application: <authentication mode="forms"> <forms name=".aspxauth" loginurl="../mvcapp/account/login" defaulturl="home.aspx" protection="all" path="/" timeout="20" slidingexpiration="true" cookieless="usecookies" enablecrossappredirects ="true" domain=&qu

python - Adding or deleting tkinter widgets from within other modules -

i'd know how can add or delete widgets within imported module. fail access them correctly. know, using oop make easier, tried grasp oop , while principles easy can't head around details, since lack proper teacher, need procedural solution. this main script: #!/usr/bin/python try: # python2 import tkinter tk except importerror: # python3 import tkinter tk import os import sys sys.path.append(os.path.dirname(os.path.realpath(__file__))) import target def myfunction(event): canvas.configure(scrollregion=canvas.bbox("all"),width=300,height=200) def test(): target.secondwindow() root = tk.tk() root.geometry("600x350+30+50") myframe = tk.frame(root,relief="groove",bd=1) myframe.place(x=20, y=30, width=560, height=200 ) canvas = tk.canvas(myframe) frame = tk.frame(canvas) myscrollbar=tk.scrollbar(myframe, orient="vertical", command=canvas.yview) canvas.configure(yscrollcommand=myscrollbar.set) myscrollbar.p

android - Java Read Date from Microsoft SQL Server Exactly without specifying TimeZone -

i have datetime field in microsoft sql server 2008 r2 database table. read table in android application using jtds.jdbc.driver successfully. have problem reading correct datetime value. resultset result = ...createstatement().executequery("select * operation"); while (result.next()) { date idate = this.gettimestamp(result.getdate("timestamp"), result.gettime("timestamp"))); } public date gettimestamp(java.sql.date date, java.sql.time time) { return new date (date.gettime() + time.gettime()); } when display idate value see there no timezone info. example date in sql server ends time 16:51 diaplayed idate has 14:51. there way , display exact datetime value microsoft sql server without specifying timezone value? it seems working different timezone. if data saving in database different timezone, current time of zone saved in database. hence need set timestamp before adding database. please refer this post explains , can out.

validation - How can I extend AngularJS model flags on an Angular form? -

angularjs provides call 'model flags' on forms. example, can have formname.$dirty, formname.$invalid, etc. want know how can create own custom flag angularjs forms? high level demonstration or link article sufficient answer. see here: how-to-add-custom-validation-to-an-angular-js-form . in short, custom valitation directive example: app.directive('blacklist', function (){ return { require: 'ngmodel', link: function(scope, elem, attr, ngmodel) { var blacklist = attr.blacklist.split(','); // dom -> model validation ngmodel.$parsers.unshift(function(value) { var valid = blacklist.indexof(value) === -1; ngmodel.$setvalidity('blacklist', valid); return valid ? value : undefined; }); //for model -> dom validation ngmodel.$formatters.unshift(function(value) { ngmodel.$setvalidity('blacklist', b

multithreading - Lua execute several tasks at once -

i have been looking solution execute several task (atleast 2) simultaneously. found coroutines in lua. can please clarify me in detail how handle 2 or more 1 task? trying run execute event , measure memory consumption process using lua script. quick solution or ideas highly appreciated. thanks take io.popen(prog [, mode]) . from the documentation io.popen , "starts prog in other process". here how implement this: -- launch prog want measure. assume not quit immediately. -- lua not block here: not wait prog exit. io.popen('script-you-want-to-measure') -- launch second process measure first. local measure = io.popen('measuring-process', 'r') -- read block until measure program exits local measure_output = measure:read('*a') f:close() -- want output

python - Pandas: get second character of the string, from every row -

i've array of data in pandas , i'm trying print second character of every string in col1. can't figure out how it. can print second character of each string individually, example: array.col1[0][1] however i'd print second character every row, there "list" of second characters. i've tried array.col1[0:][1] but returns second line whole of col1. any advice? you can use str access string methods column/series , slice strings normal: >>> df = pd.dataframe(['foo', 'bar', 'baz'], columns=['col1']) >>> df col1 0 foo 1 bar 2 baz >>> df.col1.str[1] 0 o 1 2 this str attribute gives access variety of useful vectorised string methods, many of instantly recognisable python's own assortment of built-in string methods ( split , replace , etc.).

go - How to apply separate Mutex on multiple variables in Golang? -

i have multiple variables want make mutually exclusive using method type var1withmutex struct { mu sync.mutex var1 int } func (v *var1) set(value int) { v.mu.lock() v.var1 = value v.mu.unlock() } func (v *var1) get() (value int) { v.mu.lock() value = v.var1 v.mu.unlock() return } similarly there hundreds of variable, var1, var2, var3.... var100 how make of them mutually exclusive without repeating code? note var1, var2, var3 etc not part of array , no way related each other. var2 may int , var3 may user{} you make different mutex object each type instead. playground type mutexint struct { sync.mutex v int } func (i *mutexint) get() int { return i.v } func (i *mutexint) set(v int) { i.v = v } and use this func main() { := mutexint{v: 0} i.lock() i.set(2) fmt.println(i.get()) i.unlock() }

javascript - How to only load and play the audio from a webpage embedded media file? -

the media file could html5, flash. let's ignore other formats. for html5 imagine it's not hard, finding , interacting media object , properties javascript, page loading. but flash, think it's different issue. external library necessary? you check this, site contains info might useful http://www.w3schools.com/tags/ref_av_dom.asp

How to call a function correctly in PHP OOP -

i attempting learn better oop in php , have been trying resolve number of hours , need assistance. using php 5.4 believe can use late static binding. have class called databaseobject (database_object.php) has function called create looks like: public function create() { echo "in create() "; global $database; echo "<br> table: ".static::$table_name; $attributes = $this->sanitized_attributes(); $sql = "insert " .static::$table_name." ("; $sql .= join(", ", array_keys($attributes)); $sql .= ") values ('"; $sql .= join("', '", array_values($attributes)); $sql .= "')"; echo $sql; if($database->query($sql)) { $this->id = $database->insert_id(); return true; } else { return false; } } i calling cart class (in file called cart_id.php)that extends databaseobject in function

javascript - jQuery show rows that meet criteria -

i have page multiple tabs on per region. on page load, load of data hidden table , when click on tab, pulls in table , filters data (removes rows not needed tab). for example, each tr in table has classes on region names. <tr class="americas emea apac"></tr> <- row falls 3 regions. i have tab example shows me data americas: $('#' + tab).find("#trainingevents .results tr:not(.americas)").remove(); removes rows table not have americas in class. my goal make condition 3 of them required. when click "global", row must contain 3 of classes or removed table. what best approach accomplish this? thinking contains true if 1 of them met. i think can use .filter() accomplish want: function filtertable(selector) { $("table tr").hide().filter(selector).show(); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <table>

javascript - Keep Meteor Template Rendered After Routing -

i want allow meteor app work if user goes offline. of right using iron-router router. app works great until user goes off line , tries navigate around app. current page fine routes blank. there way render of routes on app start-up , continue hold of template info if application go offline. know can achieve use of native app i.e using cordova. there convenient way without creating native application? if want app available client though it's not connected internet try appcache . puts content in browsers application cache, used there's no connection server. routes work if there's no connectivity. meteor add appcache together grounddb (for offline collections) can make application functional if you're offline. meteor add ground:db

Cross domain sessions in firebase -

we building js library included on third-party sites. when user takes action on third-party site, our library pushes write-only path on firebase corresponding url made on. to allow our clients view actions user has taken on actual site, we'd log them firebase on our end , redirect them own site. our library on site checks if uid matches 'owner' site; if so, read-access firebase path , can see these 'actions'. i hacked realise can't persist sessions between domains. work when our clients login site, through our js drop-in. we're using simple login right now, , don't have server-side. i'm using js lib. can use firebase this, or not support cross-domain sessions? i'm open spooling backend if custom auth help. cheers!

apache - Stuck on RewriteRule in htaccess -

i stuck in redirecting urls. think there can't oversee missing. when test redirect goes correct url, sticks old url behinde new url. this got stuck: rewritecond %{query_string} lang=uk&page=page rewriterule ^(.*)$ domain/page/ [l,r=301] rewritecond %{query_string} lang=fr&page=page rewriterule ^(.*)$ domain/page/ [l,r=301] rewritecond %{query_string} lang=uk&page=about rewriterule ^(.*)$ domain/about/ [l,r=301] rewritecond %{query_string} lang=uk&page=about rewriterule ^(.*)$ domain/about/ [l,r=301] rewritecond %{query_string} lang=uk&page=news rewriterule ^(.*)$ domain/info/ [l,r=301] rewritecond %{query_string} lang=fr&page=news rewriterule ^(.*)$ domain/info/ [l,r=301] i scared stuck big htaccess file if redirects individual. slow things down? lang=nl, uk, us, fr go same page. not page= got same pagename after change. in advance, you can have specific redirects first page name not same target followed single rule query pa

html - How Do I Make Large Quotation Marks Wrap Properly Around Quotations? -

i have simple div short testimonial inside. structure follows: <div id="testimonial">this testimonial.<br>a multi-line testimonial.<br>with @ least 3 lines.</div> i want wrap testimonial in quotation marks, , size , color everything, i've added following css: #testimonial { font-size: 1.125rem; color: #434343; } #testimonial::before, #testimonial::after { content: '“'; font-size: 3rem; line-height: 1rem; height: 1rem; color: #c9c8c8; }; the problem is, though i've applied both line-height , height rule quotation marks, remain larger lines of testimonial itself, messing , lines of testimonial. here's codepen demonstrate what's happening: http://codepen.io/anon/pen/zxxzpe how make large quotation marks take same vertical height testimonial text, looks neat, not messy? turns out problem 2 issues in one. first: line-height on quotation marks affects line height of last line of testimonial. such, line h

swift - Using variable as NSTimer intervals -

when try use integer variable timer interval in nstimer in swift " argument "selector in call" code : var count = 3 var timer = nstimer() @ibaction func playbuttonpressed(sender: anyobject) { timer = nstimer.scheduledtimerwithtimeinterval(count, target: self, selector: selector("result"),userinfo: nil, repeats: true) } if put 3 instead of count works want able give user advantage set interval himself. the nstimer.scheduledtimerwithtimeinterval takes double first parameter. try using: var count: double = 3.0

r - Plotting with lattice::wireframe() -

i wanted use wireframe(z ~ x * y, shade = true, scales=list(arrows=false),xlab = "x", ylab = "y",zlab = "z") both x , y have range 0 1. z however, in millions ($mm). tried plotting , kept getting 2-dimension surface plot on bottom of cube..i suspecting it's due scaling? have tips on how fix that? thank unfortunately don't have enough reputation post images.. we don't need image. need source data. if in fact "z" data range 0 1e6, few points have large values, you'll you're describing. try setting limits via zlim argument wireframe range believe captures "interesting" portion of data. another option plot log(z)~x*y , assuming z-values greater 1, or plotting z^(.25)~x*y .

facebook - error "array to string conversion" in FacebookCurl.php -

i have error.... "array string conversion" in line 66 in facebookcurl.php, i'm trying update this: custom_image page/tabs/app_id... i value custom_image input type file , use multipart/form-data.... this code in php... session_start(); require '/../../vendor/autoload.php'; require '/../config/configfb.php'; use facebook\facebooksession; use facebook\facebookredirectloginhelper; use facebook\facebookrequest; use facebook\facebookresponse; use facebook\graphuser; use facebook\graphobject; use facebook\facebookrequestexception; //app_id , secret facebooksession::setdefaultapplication($config['appid'], $config['secret']); $helper = new facebookredirectloginhelper('xxxxxxxxxx'); try { $session = $helper->getsessionfromredirect(); if($session): $_session['facebook']=$session->gettoken(); header('location: xxxx'); endif; if (isset($_session['facebook'])): $session = new fac

node.js - Need help to verify if this socket.io code will work on multiple server instances -

imagine there node.js chatting app. going hosted on aws scale across multiple instances. chat server app has piece of codes tracks online or offline using variable called "sockets". code works on single instance. code fail when server scaled across multiple instances? var sockets = {}; io.configure(function () { ... }); io.sockets.on('connection', function(socket) { socket.on('online', function(data){ if(data.userid){ sockets[userid] = socket; console.log("user " + userid + " connected."); } }); socket.on('disconnect', function () { for(var key in sockets){ if(sockets[key] == socket) { delete sockets[key]; console.log("user " + key + " disconnected."); break; } } }); }); // check if userid connected // still work when multiple server insta

CSS3 Animation Delay longer than Duration breaks animation -

i attempting animate element display:none;opacity:0; display:block;opacity:1; . while below animation works, when introduce delay animation find cannot set delay value higher animation duration value. when do, animation ignored. how set delay take e.g. 2 seconds , animation duration 300ms without breaking? div p + p { display: none; opacity: 0; } div p:hover + p { display: block; opacity: 1; /* browser prefixes removed brevity */ -webkit-animation: fadeinfromnone 300ms 900ms linear; animation: fadeinfromnone 300ms 900ms linear; } div.working p:hover + p { display: block; opacity: 1; /* browser prefixes removed brevity */ -webkit-animation: fadeinfromnone 300ms 300ms linear; animation: fadeinfromnone 300ms 300ms linear; } @-webkit-keyframes fadeinfromnone { 0% { display: none; opacity: 0; } 1% { display: b

html5 - img1 displayed twice in Lightbox -

i have following html markup generated through php: <a href="pic/img1.jpg" data-lightbox="gallery1" data-title="gallery1"> <div class="img-wrap"> <img src="pic/thumbs/img1.jpg"><span class="caption">gallery1</span></a> </div> <a href="pic/img2.jpg" data-lightbox="gallery1" data-title="gallery1"></a> <a href="pic/img3.jpg" data-lightbox="gallery1" data-title="gallery1"></a> <a href="pic/img4.jpg" data-lightbox="gallery1" data-title="gallery1"></a> <a href="pic/img5.jpg" data-lightbox="gallery1" data-title="gallery1"></a> <a href="pic/img6.jpg" data-lightbox="gallery1" data-title="gallery1"></a> <a href="pic/img7.jpg" data-lightbox="gallery1" data-t