Posts

Showing posts from June, 2015

.net - Handling file size for SQL FILESTREAM data -

what proper way handle file sizes when using sql server's filestream feature store documents in database? i know can use tsql command datalength() on filestream column, regarding this microsoft article might not best idea: avoid retrieving data length of lots of blob files in application. time-consuming operation because size not stored in sql server database engine. if must determine length of blob file, use transact-sql datalength() function determine size of blob if closed. datalength() not open blob file determine size. i bit unclear if above says should avoid datalength() if possible or if recommended way retrieve file size. if have access document sizes show user metadata, recommended way retrieve them? store them in separate field? or datalength() fast enough? i believe article suggesting not use datalength() if can avoided. storing file size in separate column suitable alternative, along other metadata files (content type, extension, timestamp

html - Redirect after Login MyWSAT -

i've been testing example code here http://mywsat.codeplex.com/ in example have different buttons login either admin pages or members page using seperate links however, i'm trying use single link landing page , after user logs in redirect relevant page using codebehind. landingpage requires login roles can view page set in rules. landingpage.aspx: protected void page_load(object sender, eventargs e) { string redirectpath; string pagepath = request.apprelativecurrentexecutionfilepath; if (page.user.isinrole("administrator")) { //admin redirectpath = "~/admin/default.aspx"; if (redirectpath != pagepath) { response.redirect(redirectpath); } } else if (page.user.isinrole("member")) { //members redirectpath = "~/members/default.aspx"; if (redirectpath != pagep

ios - Adding checkmark to selected table cell also checks another table cell -

when adding checkmark selected table cells, im seeing check appear in other cells also. my didselectrowatindexpathcode is: - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { pfobject *player = [squadlistarray objectatindex:indexpath.row]; nsstring *playername = [player valueforkey:@"fullname"]; nslog(@"%@", playername); uitableviewcell *selectedcell = [tableview cellforrowatindexpath:indexpath]; selectedcell.accessorytype = uitableviewcellaccessorycheckmark; } the nslog has expect results, showing 1 selection. any ideas? need me show other code? thanks in cellforrowatindexpath can't configuring cell when cell gets reused. should setting (and resetting) of properties of cell data model. you must have data model being used tell table view how many rows has , each cell should like. during didselectrowatindexpath should updating data model selected information. then, in ce

ruby on rails - When does ActiveRecord establish connections? -

in of rails applications, activerecord models seem establish db connections on initialization (e.g., when rails console ), while in others connections seem established when reference model class or instantiate model object. for example, went 1 application, opened rails console , wrote: somemodel.connected? and returned false . went application, entered same command (for different model), , returned true . went third application , entered same command. time, waited moment , returned true , made me think connected? method triggered connection reason. this difference in behavior doesn't seem related rails versions or contents of models. weird i've done in initializers, don't think so. so when rails establish connections? or expected behavior? additional info i'll add doesn't seem connected? returns false because rails cannot connect database. for example, in first application do: somemodel.connected? # => false somemodel.table_exists? # or o

git - Collaborating Android Studio projects on multiple machines -

using android studio make app uses google play services maps, have include google-play-services library , make sure there .jar files , jazz. fine, however, @ work use git version control. if different machine pulls down files said app git, , machine has different location library needed, user of second machine has reconfigure project use machines libraries, , when user pushes changes git, same has done next user. makes difficult, 1 can imagine, collaborate , efficiently multiple developers on same project. there best practices guide make easier or setting or i'm not familiar with? in general, should not add files version control may have local settings. should mark these files ignored in .gitignore prevent other developers accidentally adding them version control. in current projects ignore following files generated android studio: *.iml *.ipr *.iws .idea/ however, don't have same situation yours, because i'm not using external libraries now. if not op

java - How do I add an Access Denied Handler in spring-security-javaconfig -

i'm using spring-security-javaconfig library spring security. if using xml config files, i'd use define custom access denied page: <http auto-config="true"> <intercept-url pattern="/admin*" access="role_admin" /> <access-denied-handler ref="accessdeniedhandler"/> </http> here security configuration class far: @configuration @enablewebsecurity public class securityconfigurator extends websecurityconfigureradapter { @override protected void registerauthentication(authenticationmanagerbuilder auth) throws exception { auth.inmemoryauthentication().withuser("user").password("password").roles("user"); auth.inmemoryauthentication().withuser("admin").password("password").roles("admin"); } @override protected void configure(httpsecurity http) throws exception { http.authorizeurls().antmatc

php - Wordpress large file upload error -

i trying upload large files using built-in uploader (1 gig or more.) however, (randomly) http upload errors. more frequent larger file is. i having problems files larger 100 mb. in php.ini, have set: file_uploads upload_max_filesize max_input_time memory_limit max_execution_time post_max_size ...to 1.2gb 600 seconds time limits. an upload of 130mb lasts 15 minutes still fails. ajax response is: <!-- shtml wrapper - 500 server error --> [an error occurred while processing directive] is because on shared server plan? if move vps problem stop? update: i have tried ftp plugins, , uploading via standard wordpress browser uploader , same error: [an error occurred while processing directive] my problem integrating sort of ftp solution in wordpress itself. client not want use separate method uploading. rather have in wp admin. i've been looking better ftp uploader plugins seem un-supported few years. there no way @ make work within wordpress? if move sit

Threading in Google App Script -

is possible threading in google apps script? setting triggers programmatically threading. there better way? there great example bruce mcphearson . example parallel processing in apps script uses map reduce in exercise. utilizing triggers well, perhaps may provide different perspective.

html - How to add timezone to jQuery Countdown -

i using countdown found, countdown start of livestream, counting down time of pc, whereas want countdown bst (25th august @ 9am) (uk time). here html code, believe need: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" /> <link rel="stylesheet" href="ie.css" type="text/css" charset="utf-8" /> <script language="javascript" type="text/javascript" src="js/jquery-1.4.4.js"></script> <script language="javascript" type="text/javascript" src="js/jquery.lwtcountdown-1.0.js"></script> <script language="j

ruby on rails - initializer .rb file error happening -

i'm trying setup initializer fb file keep getting error after restarting rails app. here initializer file called mail_chimp.rb code inside rb file mailchimp.configure |config| config.api_key = 'blabla' end error after restarting rails. myproject/config/initializers/mail_chimp.rb:1:in `<top (required)>': uninitialized constant mailchimp (nameerror) me/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/engine.rb:609:in `block (2 levels) in <class: anyone know why i'm getting error. i'm new rails first time setting initializer file the gem 's namespace mailchimp , not mailchimp . mailchimp.configure |config| config.api_key = 'blabla' end but assumes gem linked above 1 you're working (you haven't specified otherwise) . edit: you've specified issue more clearly, need create own module. mailchimp doesn't exist, can't call configure , pass block it. 1 example implementation might

asp.net mvc - Redirect to a view -

i new mvc. need redirection view. have views folder within rentals folder inside rentals folder displayinvoicelist.cshtml want display. how can achieve this? --rentals --displayinvoicelist.cshtml [httppost] public actionresult index(rentalcustomerviewmodel amerentalvm) { try { conn.open(); amecmd.executenonquery(); strresult = amecmd.parameters["returnvalue"].value.tostring(); if (strresult == "1") { if (conn.state == connectionstate.open) { conn.close(); } //redirect page redirecttoaction("displayinvoicelist", "rental");

ruby on rails - Conflict resolution when sync Backbone models to server -

most of single page browser application supposed "collaborative" means several people can edit same document or object simultaneously (think google docs). i'm trying implement collaborative application using backbone.js , rails on backend. understand how backbone model sync works, wonder best practice handle conflicts resolution? this example: user updates field "author" of book , backbone.js model "book" sends sync request server... else updated field this book second ago. how handle situation? there common practices / frameworks / libraries handle conflicts? sign data confirm validity: creation of record on back-end: { "author": "ernest hemingway", "signature": "8332164f91b31973fe482b82a78b3b49" } then when retrieves record, signature retrieved along. when edits record signature sent back-end. if signature matches in db, it's valid edit , back-end generates new signature record

mysql - General error 2014 with PDO buffer attribute set to true -

i attempted ask here , didn't come out well. considered editing, given answers received, thought better start over. i receiving following error: fatal error: uncaught exception 'pdoexception' message 'sqlstate[hy000]: general error: 2014 cannot execute queries while other unbuffered queries active. consider using pdostatement::fetchall(). alternatively, if code ever going run against mysql, may enable query buffering setting pdo::mysql_attr_use_buffered_query attribute.' in c:\program files (x86)\apache software foundation\apache2.2\htdocs\sustainable_water_allocation\ltoo_test.php:348 stack trace: #0 c:\program files (x86)\apache software foundation\apache2.2\htdocs\sustainable_water_allocation\ltoo_test.php(348): pdostatement->execute() #1 c:\program files (x86)\apache software foundation\apache2.2\htdocs\sustainable_water_allocation\ga.php(119): totalsi(object(gaparent), 1) #2 c:\program files (x86)\apache software foundation\apache2.2\htdocs\sustainab

Python mayavi: Adding points to a 3d scatter plot -

i'm writing python application simulate motion of particles in 3-space. i'd plot positions each step, updating plot app runs, keeping past positions on plot. i'd mayavi, far can tell, 1 cannot add points existing scatter plot, must add points in 1 go. not want. want add few points @ time without having keep past points in memory redraw them @ each step. the function i've been looking @ plot3d(). http://docs.enthought.com/mayavi/mayavi/auto/mlab_helper_functions.html#mayavi.mlab.points3d any ideas on how want python mayavi? there python 3d plotting package want? suppose named object : mypoints = mlab.points3d(...) you can access @ stage current traits : mypoint_data = mypoints.mlab_source.get(['points'])['points'] and add whatever want (e.g.: want add point 0,0,1: mypoint_data = np.vstack((mypoint_data, np.array([[0,0,1]]))) mypoints.mlab_source.set(points=mypoint_data) if have scalars need updated using keyword 'sca

Batch script calling a powershell function -

is there way batch file call powershell function? i've tried powershell ". .\tes.ps1; test-me -param1 'hello world' -param2 12345" and works, function gets called, else in powershell script.    it looks you're trying dot-source tes.ps1 can use test-me function that's defined in file. when dot-source file, in file gets executed. if have other commands in tes.ps1 don't want execute, you'll need put test-me in separate file. best way that: create file called test-me.ps1 contains contents of function ( don't declare function function { [...] } , include code inside function's scriptblock), invoke in batch file: powershell "<path>\test-me.ps1 -param1 'hello world' -param2 12345"

javascript - Prompt to save a PHP dynamically created file to local computer -

i looking way results search generates file can downloaded , saves user computer. able generate file, however, gets stored on server automatically rather prompting user store it. in search form user can select checkbox generate csv file of output (i prefer have download button on results page unable figure out how that): https://www.evernote.com/shard/s68/sh/54e95567-d91e-4649-a5c1-35b5f8929c13/a4bc4fed2a2c7f7801099f6d5711c49e then in next page results shown on page , appropriate file generated. code generates file on results page: if($print_flag == 1) { $filename = "exportfile" . date("y-m-d_h_m_s") . ".csv"; $handle = fopen($filename, 'w+'); fputcsv($handle, array($column1,$column2)); fclose($handle); } $print_flag set if user checks csv checkbox in prior form. this creates file stored on server rather allowing user save locally. i saw previous questions php save file users computer not figure out how add headers or

ruby - Sinatra app not deploying to Heroku, rackup crashed -

Image
config.ru require './app' run sinatra::application gemfile source 'http://rubygems.org' gem 'heroku' gem 'sinatra' gem 'thin' procfile web: bundle exec rackup config.ru -p $port here heroku logs 2013-08-10t01:21:03.753984+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file' 2013-08-10t01:21:03.754180+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:250:in `start' 2013-08-10t01:21:03.754180+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:141:in `start' 2013-08-10t01:21:03.754180+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app' 2013-08-10t01:21:04.799863+00:00 heroku[web.1]: state changed starting crashed 2013-08-10t01:21:04.790161+00:00 heroku[web.1]: process exited status 1 2013-08-10t01:21:25.615653+00:00 heroku[router]: at=error code=h

Mistake in javascript with NaN in an array -

when execute function in javascript, nan result. seems quite ilogical beacuse arrays employed in operation numerical , shown when alert(); left code here supervision: function calculation_errors(){ arr_error_p_t2=new array(); for(var i=0;i<arr_p_t1.length;i++){ var k=new number(arr_k_t1[i]); var p=new number(arr_p_t1[i]); arr_error_p_t2[i]=(math.sqrt(1+math.pow(m_t2,2)))*(math.sqrt((math.pow(1/k,2)+(math.pow(1/p,2))))); } alert(arr_error_p_t2.join('\n')); } the reason getting nan because array arr_k_t1 has length smaller array arr_p_t1 . in for loop : trying array element greater own size statement var k= arr_k_t1[i]; it returns undefined (because have exceeded number of elements in arr_k_t1 . in javascript returns undefined if try access non-existent element of array. then doing mathematical operations on return nan (the result have got). the solution : function calculation_errors(){

html - Jquery SlideToggle divs to slide (animate) up -

i want know how can make perfect example slide instead of pushing 'navs' down http://jsfiddle.net/nprfm/3/ ...right now, reveals top bottom (pushes menu down)...i want reverse..meaning boxes slide reveal , pushes navs - clicking on 1 pushes menu reveal boxes. that fiddle on mark on want want slide reveal i tried no go .animate({scrolltop: $('.dropdown').offset().top}, 250); do have use css positioning have offset? ...still learning ropes on jquery update** here want do: http://jsfiddle.net/wfxlj/1169/ ....the issue is, cant figure way first jfiddle...where kind of has 2 functions. -==click div 1===slides -reveals content of div 1 (in same section 2) ====click div 2 after ======shows content of div 2 (in same section of 1) =====click div 2 again=======slides down box hide section and vice -versa hope make sense. update 2** i got it! check jfiddle: http://jsfiddle.net/b7c2d/315/ so thing left menu (black) needs push looks reveals.

casting - signed and unsigned in C -

code is: #include<stdio.h> int main() { signed x,a; unsigned y,b; a=(signed)10u; b=(unsigned)-10; y = (signed)10u + (unsigned)-10; x = y; printf("a=%d, b=%u",a,b); if(x==y) printf("\nx=%d, y=%d",x,y); else if(x!=y) printf("\nx=%u, y=%u",x,y); return 0; } output is: a=10, b=65526 x=0, y=0 please explain output. working on turbo c. y = 10 + 65526 = 65536 = 0 (mod 16-bits). you have remember @ end of day, signed or unsigned, bits being assigned memory location. how interpreted can matter or context. writing -10 unsigned variable same writing 65526 it.

java - Unsupported major.minor version 51.0 while executing JSP -

i trying deploy jsp , java files on server. when try access jsp error msg javax.servlet.servletexception: java.lang.unsupportedclassversionerror: com/usct/db/dbconnect : unsupported major.minor version 51.0 i read few posts , found out due difference in java version on 2 different platforms using java 1.7 on server , client when java -version in jdk/bin shows java version 1.7.0_10 , java se runtime environment (build 1.7.0_10-b18) can please me issue? thank you ... using java 1.7 on server , client when ... the explanation using java 1.6 or earlier ... despite think . in other words, when run java -version command-line, getting different java installation 1 being used run web container. (if on linux system, should able tell jvm being used running ps -efl , greping "java" or similar. alternatively, use approach suggested @dbf.) it worth noting version of java on client not relevant. exception occurring on server side. reference: h

objective c - UINavBarController connecting the same UIViewController to multiple navigation controllers -

Image
i have storyboarded app chain of tableviews followed detail view. kind of classic iphone app. there 4 tabs , each 1 leads navigation controller. the issue want avoid unnecessary glue code since app finished. if possible connect search , favorites (bottom 2 off tab bar) controller 'root view controllers' same uiviewcontroller done. however, won't work since view controller can root view controller 1 tab. can see i've instituted 2 dummy uiviewcontrollers forward uiviewcontroller in middle. now, unfortunately, have write code make central view controller fake root view controller disable appearance of button, , prevent popping blank root when double-tap tab bar. has got more elegant solution? this appears flaw in storyboards. 1 workaround use simple view controllers each navigation controller's rootviewcontroller . put uicontainerview in each points uiviewcontroller want share.

quickbooks - QBXML Query for Created Date Range -

i'm writing quickbooks 2013 integration service. synchronization works great, it's filtered modifieddaterangefilter. need create "initial synchronization" records qb createdtime. is possible create query created date range? no. not possible. see osr options available.

applescript - Using lists from another script -

in applescript can use list script eg have in 1 script set example {"a","b"} and in have choose list example can used in editor or need app? /tmp/a.scpt : property example : {"a", "b"} another script: set s (load script "/tmp/a.scpt") example of s -- {"a", "b"}

email - m.setTo(toArr) The method setTo(String[]) is undefined for the type Mail -

mail m = new mail("mail", "password"); string[] toarr = {"tt@gmail.com", "tt1@gmail.com"}; //here comes error! m.setto(toarr); //here comes error! m.setfrom("christian.schartner@gmail.com"); //here comes error! m.setsubject("using mail javamail wrapper android device."); //on m.setbody no error! m.setbody("email body."); i error in eclipse when paste code. hey had same issue, the method setto(string[]) undefined type mail just sure have activation.jar , additionnal.jar , mail.jar files of javamail api inside /libs project folder.

java - Can't lock files in TFS eclipse -

i created tfs server tutorial: http://tfs.visualstudio.com/en-us/learn/connect-eclipse after installing plugin in eclipse , connecting tfs server. whenever tried lock files getting error: tf400022: item xxx.java cannot locked checkout in workspace yyyy; checkout locks not supported in local workspaces. what doing wrong? thanks help. tfs 2012 introduces new concept called local workspaces, differ subtly behavior of workspaces in previous versions of tfs (the old default behavior called server workspace.) local workspaces not require read-only files , instead allow files edited without checking out server, , intended more suitable small medium sized workspaces. reason, local workspaces default in tfs 2012. local workspaces, however, not support locking files check-out, since action requires communication server. thus, locking files requires server workspace. you can convert workspace created vs 2012 client server workspace. in edit workspace dialog, select advance

List installed media players Android -

i'm trying list of apps can handle media installed on android. i've tried methods listed here ( how list of installed media players ), none of them worked. return empty list , have multiple media players installed, recognized headset droid ( https://play.google.com/store/apps/details?id=tvk.headvol ). can suggest alternative method or might have , idea problem can be? need set permissions? edit: found solution myself: intent intent = new intent(intent.action_media_button); list<resolveinfo> pkgappslist = packagemanager.querybroadcastreceivers(intent, 0); here came with: packagemanager packagemanager = this.getpackagemanager(); list<resolveinfo> pkgappslist; intent intent = new intent(intent.action_media_button); pkgappslist = packagemanager.querybroadcastreceivers(intent, 0); this provides list apps can handle action_media_button intent. these media apps.

jquery - 500 Internal Server Error on ajax call with cakephp -

i developed small website cakephp working locally, , moved in production environment on tophost. after have fighting .htaccess config file, got homepage work. when click on buttons should open detail page, 500 error on $.ajax call. ideas? this .htaccess in htdocs folder: <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ /cakephp/app/webroot/ [l] rewriterule (.*) /cakephp/app/webroot/$1 [l] </ifmodule> and following ajax call: $.ajax({ type: "post", url: "/track", data: id, datatype: "text" }).done(function(data) { ... }

Load model to array in rails -

if save array using @levels.each(&:save) how load model level? is: appropriate command repopulate array saved data @levels = level.find_all does not seem exist, pretty new see, want store , load, levels! here's gamescontroller: def initialize @levels = [] unless @levels @levels = levels end def add_level levels << level.new levels.each(&:save) redirect_to edit_game_path(params[:id]) end and model: class game < activerecord::base has_many :levels end if association : game has many levels , level belongs game. then, @game = game.find_by_id(params[:id]) #whoesoever game page @levels = @game.present? ? @game.levels : [] i hope, understood problem

bash - Cutting and Greping info from CSV in Ruby -

i have huge .csv file following headers: timestamp,url,ip embedded in url requests youtube video id identifiers needs extracted. input "26 jul 2013 00:01:01 utc","http://r2---sn-nwj7km7e.c.youtube.com/videoplayback?algorithm=throttle-factor&burst=40&clen=255192903&cp=u0hwsvhmuv9gtunonl9qrlvholbstxhmq2ftrvry&cpn=lwn6qrn2_odocql_&dur=4259.840&expire=1374813613&factor=1.25&fexp=900223%2c912307%2c911419%2c932217%2c914028%2c916624%2c919515%2c909546%2c929117%2c929121%2c929906%2c929907%2c925720%2c925722%2c925718%2c925714%2c929917%2c929919%2c912521%2c904830%2c919373%2c904122%2c919387%2c936303%2c909549%2c900816%2c936301%2c912711%2c935000&gcr=in&gir=yes&id=10ff11582e78027b&ip=132.93.92.117&ipbits=8&itag=134&keepalive=yes&key=yt1&lmt=1368924664324037&ms=au&mt=1374793074&mv=m&nh=eai&range=143196160-144138239&ratebypass=yes&signature=78b2b03afe619c43e61b30ac228b9c33990b2d89.cad

c# - The underlying provider failed on Open in entity framework connection -

i use entity framework in .net 4 , use connection in project: <add name="database1entities" connectionstring="metadata=res://*/model.model1.csdl|res://*/model.model1.ssdl|res://*/model.model1.msl;provider=system.data.sqlclient;pr ovider connection string=&quot;data source=.\sqlexpress;attachdbfilename=|datadirector y|\database1.mdf;initial catalog=database1;integrated security=true;user instance=true;multipleactiveresultsets=true&quot;" providername="system.data.entityclient" /> and show error: the underlying provider failed on open. i don't know why error use connection string , don't have problem. remember name of dbcontext class , connection string should same <add name="mydb" connectionstring="server=127.0.0.1;user id=sa;password=password;database=database" providername="system.data.sqlclient"/>

java - why does return type of values in iterator not a set? -

in map interface collection<v> values(); why function not return set entryset() , keyset() ? thanks. in map, keys unique can map same value. put way: the values not unique , therefore cannot stored in set without losing duplicates. the keys , entires, on other hand, unique.

jquery - How to disable select box hover color on css -

i want disable lightblue color in select box on mouse hovering...... don't want blue color on mouse hover. here fiddle .select_box { color: white; background-color: red; } .itemone { background-color: red; } .itemone:hover { background-color:red; } .itemtwo { background-color: green; } the blue color, the default color rendered each browser . you can moved plugin chosen

logging - Size of "Bytes sent" in apache log file -

i added apache log file information-> %o indicated bytes sent user including headers . here question how count size of headers ? have tried $env{'content_length'} isn't it. i believe there must way determine headers size cgi script have no idea how. thanks in advance ;) %b logs size of bytes without headers, can calculate diff header size.

html - Disqus: how to customize counters -

i trying customize disqus comments count in blog page http://www.lowcoupling.com problem although, can see, have manage remove word comment(s) can't see how disable/remove reactions count. there way that? can't find in settings page go disqus admin , add html tags there so: zero comments | 0<span style="display:none;"> 1 comment | 1<span style="display:none;"> multiple comments | {num}<span style="display:none;"> 0 reactions | 0 reactions</span> 1 reaction | 1 reaction</span> multiple reactions | {num} reactions</span>

linux - lpr to print files with different names and directories -

i have script witch use lpr print output pdf file. change location or file name of saved file. read several forums lpr , did not find on how specify name , directory of printed pdf. instead standard name in pdf directory. thank you! take @ cups-pdf, https://help.ubuntu.com/community/pdfprinting . can configure output directory , filename it. configuration file /etc/cups/cups-pdf.conf.

Animation in splash screen android doesn't work properly -

i have transition on slashscreen animation starts, others not. can't understand how solve this, here splash activity animation of textview. strange thing works correctly, in particular on emulator works more times on device. public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.splash_screen); title1 = (textview)findviewbyid(r.id.textview1); animation1 = animationutils.loadanimation(this,r.anim.long_slide_left); title1.startanimation(animation1); new handler().postdelayed(new runnable() { public void run() { intent intent = new intent(); intent.setclass(splashscreenactivity.this, mainactivity.class); splashscreenactivity.this.startactivity(intent); splashscreenactivity.this.finish(); // transition splash main menu overridependingtransition(r.anim.activityfadein, r.anim

user interface - how to change behavior of buttons in win8 -

i writing application win8. on mainpage there buttons, on wpf window. when enter (point) on of buttons background becomes background of grid inside. how can change this? you can change default colors of controls if override them in app.xaml file. you can find here pretty big list of customizations can controls, such method. just change in app.xaml, need, : <resourcedictionary.themedictionaries> <resourcedictionary x:key="default"> <!-- button colors change--> <solidcolorbrush x:key="buttonpointeroverbackgroundthemebrush" color="yourcolorhere" /> </resourcedictionary> </resourcedictionary.themedictionaries> note these changes made @ level of entire app. means, can't use 2 customizations same control.

c - Perfect/ideal hash to isolate anagrams -

in effort accelerate fast-out behaviour on testing strings anagrams, came with prime-based hashing scheme -- although looks wasn't first . the basic idea map letters prime numbers, , compute product of these primes. rearrangement of letters have same product, , if result can arbitrarily large no combination of other letters can produce same result. i had envisioned just hash. product overflow , start alias other letter combinations. however, mapping frequent letters smallest primes product grows , can avoid overflow altogether. in case perfect hash, giving both definite positive , negative results without additional testing. what's notable doesn't fill coding space efficiently before overflowing. no result have prime factors greater 103, , distribution of small primes fixed , not great match letter frequency. now i'm wondering if there's substantially better this. covers more results perfect hashes , has strong distribution in remaining cases.

How does one create multiple instances of filepicker (each one using a different account) on one page? -

i have js library uses filepicker upload files our service. have customer filepicker customer (using on site). when embeds our js library our instance of filepicker collides his. how 1 create multiple instances of filepicker (each 1 using different account) on 1 page?

php - Generating hirarchical structure out of a flat table -

Image
main question: efficient way transform flat table tree hierarchical structure ? context: bit rusted , don't know if should handled on sql, php or javascript (kendo ui) side ! for kendo treeview (hierachicaldatasource), must export json encoded tree structure table made single select multiple joins multiple tables... generates huge table of following logical structure: goal group "date", "client", "employee" , list "events". need structure one: guess best series of php loops ?... code ? thanks ! try php code: $result = array(); foreach($data $row) { $date = $row['date']; $employee = $row['employee']; $client = $row['client']; $event = $row['event']; $result[$date][$client][$employee][] = $event; } i suppose $data through simple query before code.

javascript - Re-render view without models changed backbone -

i'm rendering view collection of user.when specific attribute(status=online,offline) in user change view correctly show on dom value of attribute changed. if want render view without model in attribute changed or viceversa add view model in wich attribute changed? this code send view collection users status online: var user_on=models.utenti.filter(function(model){ return model.get('status') === "on"; }); var users_online = new usercollection(user_on); var page=new homelistuser({model:users_online}); this.changepage(page); and view: var homelistuser = backbone.view.extend({ tagname: "ul", id: "list", template: handlebars.compile(template), initialize: function () { models=this.model; this.model.bind("reset", this.render, this); $(window).on('orientationchange', this.onorientationchange); }, render: function (eventname) { $(this.el).empty(); _.each(this.m

3d - Keep object size constant when rotating 3-D Matlab plot -

i trying generate set of views of 3-d object in matlab such angle changes object size stays constant. because matlab tries fit entire axis view, object shrink or grow depending on whether plot viewed head-on or @ angle. example: [x,y,z] = sphere(50); % coordinates of sphere surf(x,y,z); % plot sphere axis image off view(0,0) % @ angle sphere fills axes view(-37.5,30) % @ angle sphere smaller how can make sphere appears same size no matter angle it's viewed at? the axis function friend here. try adding axis vis3d from help, "axis vis3d freezes aspect ratio properties enable rotation of 3-d objects , overrides stretch-to-fill." if you're interested same can accomplished via ax = gca; props = {'cameraviewangle','dataaspectratio','plotboxaspectratio'}; set(ax,props,get(ax,props));

android - Why is Canvas.drawText slower when the text is not drawn entirely within the view? -

i have weird performance issues custom view. here simplified example : protected void ondraw(canvas canvas) { super.ondraw(canvas); canvas.drawbitmap(bitmap, 0, 0, null); canvas.drawtext("test", 0, 30, textpaint); } bitmap small background image. string drawn on top large text size top 10 (or so) pixels cropped, want. i have around 100 views in listview (10 per row). scrolling through list incredibly slow, strange reason, becomes smooth if change drawtext() coordinates text fits within bounds of view. what going on? why slow draw text outside of bounds? i'm running android 4.2.2 (can't try on other versions, emulator isn't great test layout performance). it possible skia needs calculation , allocation per glyph (letter) out of bound. if situation text being out of screen on left or right, or when have full screen text , top and/or bottom line half visible such performance problem ignorable. in case more skia developers assu

java - How to extract the left most common characters in a string list? -

assume have following list of string objects: abc1, abc2, abc_whatever what's efficient way extract left common characters list ? i'd abc in case. stringutils.getcommonprefix(string... strs) apache commons lang.

php - How do I populate a table with values from a dropdown box? -

i have 3 tables , 2 dropdown boxes. have populated 2 of tables , entered values dropdown boxes. now, choose value both of dropdown boxes , put values third dropdown box. <fieldset> <legend>new cast</legend> <table> <form action="04castdb.php" method="post"> </fieldset> <?php $query = "select * dbhx_movie"; $result = mysql_query($query); if(!$result) { die("query failed"); } echo "<select name='movie'>"; while($row = mysql_fetch_array($result)) { echo "<option value='$row[pk]'>$row[name]</option>"; } echo "</select>movie</br>"; echo "<select name='actor'>"; $query = "select * dbhx_actor"; $result = mysql_query($query); if(!$result) { die("query failed"); } while($row = mysql_fetch_array

Separating Angularjs and Rails apps as standalone components -

i wanted try out angularjs. however, have been trouble deciding on should located angular app. i using rails framework backend. have seen tutorials entire angular app lives under assets/javascript folder. i wondering if instead of living within assets/javascript folder, make live outside rails directory entirely. way, can potentially separate backend , front end entirely. (is recommended?). i believe asset pipeline precompiles lot of assets. if separate out angularjs asset, need precompile assets somehow? thanks you use grunt based workflow: how manage angularjs workflow lots of script files http://newtriks.com/2013/06/11/automating-angularjs-with-yeoman-grunt-and-bower/ if start decoupled frontend, use mocks @ first can stay within angular , not lose focus switching between backend , frontend logic. advantage of building single page application can develop independently of backend api. see ( http://docs.angularjs.org/api/ngmocke2e .$httpbackend) informatio

c# - how can i use 1 contextmenustrip on many buttons -

my program has many buttons. use "1" contextmenustrip when right click on button options "change color red". problem dont know how code button. private void changecolortoolstripmenuitem_click(object sender, eventargs e) { btn1.backcolor = color .red; } now can change color 1 button if need buttons takes long time , need use more 1 contextmenustrip. need change color button right click. i sorry bad english if not clear try explain again. thanks you can use sourcecontrol() property of main contextmenustrip determine button source of event: private void changecolortoolstripmenuitem_click(object sender, eventargs e) { control ctl = contextmenustrip1.sourcecontrol; ctl.backcolor = color.red; }

Unable to read object variable in ssis -

Image
need guys. came across problem while developing package client. saving result set of sql task in user variable (object) , trying access in various script tasks. scope of variable set package level. when use below code, able retrieve value of in script task of s.container , if use same code in script task of s.container2, unable to. in later, 'dt' shows headers , not data. any reason particular behavior.? missing ? sql task code ----------- select * dimproduct script task code ----------- datatable dt = new datatable(); datarow row = null; oledbdataadapter oleda = new oledbdataadapter(); oleda.fill(dt, dts.variables["variable"].value); foreach (datarow row_ in dt.rows) { row = row_; } edit :: following code doesn't work. variables lockedvariables = null; dts.variabledispenser.lockforwrite("user::variable"); dts.variabledispenser.getvariables( ref lockedvariables); object a;

javascript - Call a function in ng-repeat -

this question has answer here: how dynamically define function call ng-click in angularjs directive template 2 answers i have array names of buttons , names of function called when button clicked. if ng-repeat through buttons works fine, except function not being executed. i'm not sure else can try, or if it's possible. here data $scope.something = [{ name: 'cool button', func: 'test' }, { name: 'another button', func: 'something' }] and i'm using ng-repeat so. <button ng-click="some.func" ng-repeat="some in something">{{some.name}}</button> here things have tried function working. some.func // nothing happens some.func() // throws error {{ some.func }}() // nothing happens here 1 of functions that's called $scope.test = function() { alert('cl

mysql - PHP Script not updating sql -

here code. <center> <html> <body> <form method="post" name="awardlist" action="<?php echo $_server['php_self']?>"> <script> function awardsort($id) { document.awardlist.hiddenid.value = $id; document.awardlist.submit(); } </script> <table border=1> <input type="hidden" name="hiddenid" /> <tr> <th><b>award</b></th> <th><b>issue id</b></th> <th><b>sort #</b></th> <th><b>submit</b></th> </tr> <?php $userid = ($vbulletin->userinfo['userid']); $query = ("select a.*, userdisplayorder, issue_id award join award_user aw on a.award_id = aw.award_id aw.userid = '$userid'"); if (isset($_post['submit'])){ $userdisplayorder = mysql_real_escape_string($_post['userdisplayorder']); echo $_post[hiddenid]; echo '<br>

How Do I Store A Calculated Value In Rails -

i working on project want show post has least feedback (the goal encourage feedback on works in progress). have figured out calculation - although feedback welcome - however, having trouble assigning value column ( :feedback_score ) on post model. need help. post.rb: class post < activerecord::base def feedback_score_calc time_passed = ((time.now - self.created_at)/1.hour).round(3) feedback = self.comments.count self.feedback_score = time_passed / feedback end end i need know how call method whenever new comment added, , need able calculate on form of schedule. goal display least engaged on first visit paging progress 2nd least engaged, 3rd, etc... my other problem can't method run through console, no method error, when using def self.feedback_score_calc . with code you've provided it, it's instance method on post . should able like @post = post.find(some_id_here) @post.feedback_score_calc creating class method d

Corona SDK(LUA) - attempt to call upvalue 'spawnEnemy'(a nil value) -

Image
i trying add eventlistener object, should disappear when tap on it. error mentioned in title. here whole code @ point : -- housekeeping stuff display.setstatusbar(display.hiddenstatusbar) local centerx = display.contentcenterx local centery = display.contentcentery -- set forward references local spawnenemy -- preload audio -- create play screens local function createplayscreen() local bg = display.newimage("background.png") bg.y = 130 bg.x = 100 bg.alpha = 0 local planet = display.newimage("planet.png") planet.x = centerx planet.y = display.contentheight +60 planet.alpha = 0 transition.to( bg, { time = 2000, alpha = 1, y = centery, x = centerx } ) local function showtitle() local gametitle = display.newimage("gametitle.png") gametitle.alpha = 0 gametitle:scale (4, 4) transition.to( gametitle, { time = 500, alpha = 1, xscale = 1, yscale = 1 }) spawnenemy()

javascript - jQuery Load() not loading within div -

i trying use jquery open href inside div, rather linking new page. have viewed number of tutorials load() function not seem working me. please take @ code , let me know piece of puzzle missing. here html page: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>jquery</title> </head> <body> <!-- nav links open in div#content area --> <a class="menu_top" href="pages/home.php">home</a> | <a class="menu_top" href="pages/about.php">about</a> | <a class="menu_top" href="pages/contact.php">contact</a> <!-- div links open in --> <div id="content-area"></div> <script type="text/javascript" src="jquery-1.10.2.min.js"></script> <script type="text/javascript" src="js/nav.js"></script> </body> and jquery javascr

jquery - JavaScript scope with JSON object -

this function called when element clicked. creates string based on element clicked, , looks value associated string in json object. alerts value. here's how looks: function alerthelp(){ var option = $(this).context.parentnode.textcontent.substring(0, $(this).context.parentnode.textcontent.length - 2); $.getjson("messages.json", function(json, option) { alert(json[option]); }); } what i've found option set correctly, when passed function alert changed. if alert(option) right before alert(json[object]); , alert says "success". not sure what's that. alert(json[option]) alerts "undefined". here's messages.json: { "space control": "red = square black controls. green = square white controls. yellow = square contested both players", "legal moves": "click on piece , blue dot appear on squares piece can move to", "pieceflair": "when move piece, piece