Posts

Showing posts from April, 2015

racket - Rotate a List of Lists -

i want take arbitrary list of lists , "rotate" it. is, list of lists of size 3x3: #lang racket (require rackunit) (define (rotate-lol lol) (append (list (map first lol)) (list (map second lol)) (list (map third lol)))) (check-equal? (rotate-lol (list (list 'a 'b 'c) (list 'd 'e 'f) (list 'g 'h 'i))) (list (list 'a 'd 'g) (list 'b 'e 'h) (list 'c 'f 'i))) i'm thinking list-ref replace first / second / third can't quite figure out concise way this. i know there has got elegant way this. i've done inelegant solutions problem in past more domain specific, i'd solve general case, stash in personal library, , done problem. tips or solutions? it's pretty zip , don't have make since it's in srfi-1 list library : (require srfi/1) (zip '(a b c) &#

Rails Grape API versioning -

i trying create skeleton rest api using rails 4.0.4 , grape 0.7.0 behave this: calling api specific version: $ curl -h accept=application/vnd.acme-v1+json http://localhost:3000/api/a “a-v1” $ curl -h accept=application/vnd.acme-v1+json http://localhost:3000/api/b “b-v1” calling api default: $ curl http://localhost:3000/api/a “a-v2” $ curl http://localhost:3000/api/b “b-v1” $ curl http://localhost:3000/api/c “c-v2” i have been trying couldn't desired behavior. ended following files in rails app: app/api/api.rb require 'grape' require 'api_v1.rb' require 'api_v2.rb' module api class base < grape::api mount api::v2 mount api::v1 end end app/api/api_v1.rb require 'grape' module api class v1 < grape::api version 'v1', using: :header, vendor: 'acme', format: :json prefix 'api' format :json :a "a-v1" end :b "b-v1" end end end a

file - I need to write a Python script to sort pictures, how would I do this? -

what i'm looking script can go through huge list of pictures , sort them folders. so take pictures of dogs @ shows, lets take several pictures of dog1, dogs picture automatically named in serial number format (dog1-1, dog1-2, dog1-3, etc). dog2 follow same format. i'd script can take dog1-1-10 , move them folder named dog 1. dog2-1-10 folder named dog 2, etc. how can done in python? so basically, want is: find every file in given folder take first part of each filename , use folder name if folder doesn't exist, create it move file folder repeat well, nifty! figuring out want half battle -- now, it's matter of googling , turning code. first, need folder check in: folder_path = "myfolder" now, want find every file inside folder. quick googling session turns this : import os import os.path images = [f f in os.listdir(folder_path) if os.path.isfile(os.path.join(folder_path, f))] as aside, i'm going using os.path.join fa

javascript - How to check client perfomance for webgl(three.js) -

i have graphic project using three.js , want check client gpu performance automatically , compute how many elements can load in application. think gpu benchmark. take @ stats.js , this threex plugin , webgl inspector .

matlab - Query for SVM classifier : svmtrain function -

i want use svmstruct = svmtrain(training,group) 2 classes ( noraml , abnormal ) images classification purpose,and size of training matrix 1*40 cells ,and each cell 75 rows * 10 columns want give training matrix svmtrain function after calling svmtrain function got error : error using svmtrain (line 241) training must numeric matrix could guide how correct error, because stuck in error, thank you. the following code lines tried : clc clear all; close all; %% after creating them in section of code section loading 2 training matrices load('norglobal_matrix_train_variablek10bin25md.mat') load('abglobal_matrix_train_variablek10bin25md.mat') counter_im=1; [row ,col]=size(norglobal_matrix_train_variablek10bin25md); i=1:10:row temp=norglobal_matrix_train_variablek10bin25md(i:i+9,1:end); trasposed_temp=temp'; normal_features {counter_im} =trasposed_temp; traininglabel{counter_im}=1 ; counter_im=counter_im+1; end svm=svmtrain(

javascript - EmberJS multiple controllers on one page -

is possible have multiple controllers on 1 route / page. want show 2 features of application on 1 page. not directly related each need it's own controller, model , (partial) view. but can't seem figure out how this. it seems must use {{render}} option here. is possible have subdirectory structure here? when have {{render "dashboard.users"}} template in template/dashboard/users.hbs controller can't seem find looks , naming conventions should be. e.g. should app.dashboarduserscontroller = ... ? edit: looks should be, shouldn't place in subfolder of controllers name dashboard_users_controller.js you effect rendering templates multiple outlets of parent template: guide , api docs here running jsbin demonstrating it

c - What does clear_page_c do? -

during profiling, see of time spent in clear_page_c , followed memset . however, not know sure clear_page_c is. i assume clear_page_c sets data in page 0 haven't found documentation. best thing found far, quote this link : the clear_page_c function more worrying, kernel function related control of memory. web search did not reveal more information. you can read source find out does, though it's written in assembly, not c. short answer is, yes, fills page zero. http://code.woboq.org/linux/linux/arch/x86/lib/clear_page_64.s.html

Assign a function pointer using template method? -

consider utility class below: it contain lots of factory methods same signature int function(int a, int b); utility.h class utility { public: template<typename t, typename a, typename b> static int get_function(t% function, int% number) { function = (t) add; number = 10; return 0; } static int add (int a, int b) { return a+b; } }; this contains template method (get_function()) assign function pointers factory methods available in utility class. main.cpp typedef int (__stdcall *fp) (int a, int b); ref class fpclass { public: static fp fp; static int number; static void apply_function() { utility::get_function<fp, int, int>(fpclass::fp, number); cout << fpclass::fp(25, 45); } }; void main() { fpclass::apply_function(); } what want achieve is, assign function pointer ( fpclass::fp ) template method ( utility:ge

php - minlength doesn't work with jquery validation -

i using jquery validation in zend 2. other validation types working except minlength. here form code: $this->add(array( 'name' => 'usr_name', 'attributes' => array( 'type' => 'text', 'id' => 'firstname', 'class' => 'form-control', // jquery validation rules: 'required' => 'true', 'minlength' => '2', 'maxlength' => '20', ), 'options' => array( 'label' => 'name', ), )); here js code: $('.form-validation').each(function () { $(this).validate({ errorelement: "span", errorclass: "help-block", highlight: function(element) { $(element).closest('.control-group').removeclass('success').addcl

php - Salt is not stored in the database in yii2 -

in yii2,the table structure user table not include salt column. $this->createtable('tbl_user', [ 'id' => schema::type_pk, 'username' => schema::type_string . ' not null', 'auth_key' => schema::type_string . '(32) not null', 'password_hash' => schema::type_string . ' not null', 'password_reset_token' => schema::type_string . '(32)', 'email' => schema::type_string . ' not null', 'role' => schema::type_smallint . ' not null default 10', 'status' => schema::type_smallint . ' not null default 10', 'create_time' => schema::type_integer.' not null', 'update_time' => schema::type_integer.' not null', ], $tableoptions); this make me confused. although yii uses salted hash, not stored in database default. should

android - testing with mock in robotium -

i using mock test in rbotium. first test fail , test pass. think because of mock not ready test. when add fake test of tests passes. my fake test: public void test_showa_homeactionbartabclicked() { assertequals("",""); } all tests: public void test_showcategorygameslistfragment_categorylistactionbartabclicked() { //click on categories action bar tab getsolo().clickontext(getsolo().getcurrentactivity().getstring(r.string.title_section1)); getsolo().clickontext(getsolo().getcurrentactivity().getstring(r.string.games_title)); assert.asserttrue(getsolo().searchtext("game_category title")); } public void test_showcategoryappslistfragment_categorylistactionbartabclicked() { //click on categories action bar tab getsolo().clickontext(getsolo().getcurrentactivity().getstring(r.string.title_section1)); getsolo().clickontext(getsolo().getcurrentactivity().getstring(r.string.ap

java - Protocol not found -

my code: public class magadapter extends arrayadapter<maginfo> { private layoutinflater inflater; public string imgstore="http://******.com/cms/document/images/books/"; public static string imgurl=""; public magadapter(context context,list<maginfo> newsadapter) { super(context,r.layout.mag_listview,newsadapter); // todo auto-generated constructor stub inflater=(layoutinflater) context.getsystemservice(context.layout_inflater_service); // todo auto-generated constructor stub } public view getview(int postion,view contentview,viewgroup parent) { view item=inflater.inflate(r.layout.mag_listview,parent,false); new displayimagefromurl((imageview) item.findviewbyid(r.id.imageview1)).execute(imgurl); textview tv1=(textview) item.findviewbyid(r.id.textview1); //textview tv2=(textview) item.findviewbyid(r.id.textview2); //creating object of student

ruby - Rails Caching in Agile Web Development w/ Rails4 -

i'm working way through book agile web development rails4, , read (first) part caching parts of view avoid overwhelming database. i've of course set caching option true in config development environment. the problem caching doesn't seem working. here app/views/store/index.html.erb file, 1 given in book, enable caching : <% if notice %> <p id="notice"><%= notice %></p> <% end %> <h1>your pragmatic catalog</h1> <% cache ['store', product.latest] %> <% @products.each |product| %> <% cache ['entry', product] %> <div class="entry"> <%= image_tag(product.image_url) %> <h3><%= product.title %></h3> <%= sanitize(product.description) %> <div class="price_line"> <span class="price"><%= number_to_currency(product.price) %></span> </div&

String to String Array Java -

i have big problem. have try search solution, don't have find solution. have code public static string getstring() throws ioexception { string content = null; file folder = new file("c:\\soluzioni.txt"); content = fileutils.readfiletostring(folder) + "\n"; string remainingstring = content.substring(content.indexof("["), content.lastindexof("]") + 1); system.out.println(remainingstring); return remainingstring; } and ok. (for clarity) output :[40,-13,-6,-7,-4] [28,-40,45,-29,37] [-43,19,-24,-9,-45] [26,-41,-28,-16,44] my problem now: public static string[] arg() throws ioexception { string[] strarray = { getstring() }; system.out.println(strarray); return strarray; } when print strarray, have error (eclipse show me this: [ljava.lang.string;@796686c8). need string (remainingstring) become array of strings(strarray), maintained same format, is, output :[40,-13,-6,-7,-4] [28,-40,

Java: Same string returns different byte arrays -

i expect byte representation of 2 identical strings identical yet not seem case. below code i've used test this. string test1 = "125"; string test2 = test1; if(test1.equals(test2)) { system.out.println("these strings same"); } byte[] array1 = test1.getbytes(); byte[] array2 = test2.getbytes(); if(array1.equals(array2)) { system.out.println("these bytes same"); } else { system.out.println("bytes not same:\n" + array1 + " " + array2); } thanks in advance help! byte representations of 2 identical unrelated string objects identical byte-for-byte. however, not the same array object, long string objects unrelated. your code checking array equality incorrectly. here how can fix it: if(arrays.equals(array1, array2)) ... moreover, different byte arrays if call getbytes on same string object multiple times: string test = "test&quo

sql - Access Query Criteria -

i need syntax microsoft access query criteria states that if tbla.cola = tblb.cola , tbla.colb = tblb.colb , tblb.colc = queryfielda , tblb.cold = queryfieldb give me number in tblb.col e end if any suggestions? i assume 2 tables have joined on cola , colb (difficult without knowing structure of tables). select tblb.cole tbla inner join tblb on tbla.cola = tblb.cola , tbla.colb = tblb.colb tblb.colc = queryfielda , tblb.cold = queryfieldb

sql server - Obtain records with multiple instances of field values -

i have patient database , trying extract list of patients have particular diagnosis , have specific procedure performed. problem want retrieve list of patients have procedure done @ least twice. here sample data. table name = "clinicaldata" patientid diagnosis procedure proceduredate -------------------------------------------------------------------------- 1 laceration stitches 2/12/2013 1 fracture cast 2/12/2013 1 fracture cast 2/13/2013 2 lung-cancer chemotherapy 4/07/2013 2 lung-cancer radiation 3/02/2013 2 liver-cancer chemotherapy 6/03/2013 3 diabetes hemoglobin-a1c-check 3/12/2013 3 diabetes hemoglobin-a1c-check 7/11/2013 select patientid,

java - Exception being thrown incorrectly -

i using pre-written classes textbook , implementing them program. duplicate error being thrown every time try add new element tree, , have no idea why, , haven't manipulated written code @ all. basically, program prompts user enter information, , take info , add student binary search tree, have following textbook: abstractbinarytree class: public abstract class abstractbinarysearchtree<e extends comparable<? super e>> implements binarysearchtree<e> public void add( e element ) { if ( element == null ) { throw new searchtreeexception(); } setroot( add( null, this.root(), element ) ); size++; } ... linkedbst class: public class linkedbst<e extends comparable<? super e>> extends abstractbinarysearchtree<e> { public linkedbst( e element ) { if ( element == null ) { throw new java.lang.illegalargumentexception( "null element illegal" ); } this.root = new bstnode<e> ( element ); this.size = 1; } protected void setr

Starling ios drag object larger than screen and set boundaries -

in starling have large movieclip. movieclip avout 800% wider screen. if use as3 can set boundary, in can drag large mc. way mc cannot dragged out of screen (so empty background shown). know if possible in starling? pseudo-code below 1. add mc stage 2. add eventlistener touchevent on mc 3. drag mc 0,0 coordinates smaller stage 0,0 coordinates 4. drag mc widthx,widthy within stagewidthx, stagewidthy hope makes sense? want drag large mc around within screen area. cheers. ps: sorry not including example, have no clue how this. you can examining touchphase of touchevent see finger dragging to, , update x position of movieclip if new position falls within stage boundaries. here example, using quad same movieclip:- package { import starling.core.starling; import starling.display.displayobject; import starling.display.quad; import flash.geom.point; import starling.display.sprite; import starling.events.touchevent; import

opengl - LWJGL Display.create() does nothing on mac -

on linux, display.create() works wonderfully. on mac, function call never returns, , not throw error. cause this? because i'm adding java.awt.canvas? if so, why has worked before? edit: happens when lwjgl embedded in canvas in swing and running on thread separate swing thread.

php - Updating a row on an Admin Page -

i trying create admin page pull rows table , allow "admin" make changes. while can figure out code. suggest me how can display row data , make editable , saveable database. if "admin" needs update artist name, how manage keeping other data intact. don't know how done. the update page far : <?php //creating mysql connection $con=mysqli_connect('localhost','souravbasuroy','2525','myteraart'); // ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>untitled document</title> <link href="admin-styles.css" rel="stylesheet" type="text/css"> </head> <body> <h1>admin panel: paintings | mytera art</h1> <h2>update painting</h2> <hr> <div> <h1>search painting name :</h1> <form name="searchbypainting" action="editpainting.php" method="post"> &l

Apache Rewrite Rule httpd-vhosts.conf -

i have vhost following rule rewriteengine on rewritecond %{document_root}%{request_uri} !-f rewriterule ^.*$ /router.php [nc,qsa,l] pretty makes every url go through advanced routing system however, becoming conflict when trying set news system using wordpress. all need creating new rewrite rule put through router exception of 1 directory, example named "wordpress." its on local machine, here entire vhost config <virtualhost *:80> documentroot "/users/tyler/documents/mysite" servername mysite.local rewriteengine on rewritecond %{document_root}%{request_uri} !-f rewriterule ^.*$ /router.php [nc,qsa,l] <directory "/users/tyler/documents/mysite"> allowoverride order allow,deny allow </directory> </virtualhost> all need creating new rewrite rule put through router exception of 1 directory, example named "wordpress." based on criteria, should add follow

Android image size (portrait only) for mdpi, hdpi, xhdpi, xxhdpi -

i work on android project app force portrait only, have design pictures , cut image build ui. however, problem how should scale each picture? what found far xlarge (xhdpi): 640x960 large (hdpi): 480x800 medium (mdpi): 320x480 small (ldpi): 240x320 but found hdpi = mdpi * 1.5 xhdpi = mdpi * 2 xxhdpi = mdpi *3 but mdpi * 1.5 should 480 * 720 ? how should resize picture each resolution? thanks those resolutions guidelines not absolutes, , represent general amount of pixels in each dpi "bucket". i'd use scaling factors instead. whatever image's resolution, scale appropriately. instance, raw image files designed xxhdpi version. scale down 3, 2, , 1.5 lower dpi versions.

What causes javascript error "Expected identifier and instead saw else"? -

error message: "expected identifier , instead saw else." here's code (all javascript) : // write function below. // don't forget call function! var sleepcheck = function(numhours) { if (numhours >= 8); { console.log("you're getting plenty of sleep! maybe much!"); } else { console.log("get more shut eye!"); } }; console.log(sleepcheck) shouldn't have semicolon here: if (numhours >= 8); { an if statement structure should this: if (condition) { } else if (condtion2) { } else { }

ruby on rails - No database file specified. Missing argument: database -

i running ruby on rails stack following configuration : ==> ruby -v ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] ==> rails -v warning: you're using rubygems 1.8.23 spring. upgrade @ least rubygems 2.1.0 , run `gem pristine --all` better startup performance. rails 4.1.0 ==> gem -v 1.8.23 my config/database.yml looks : default: &default adapter: sqlite3 pool: 5 timeout: 5000 development: <<: *default database: db/development.sqlite3 test: <<: *default database: db/test.sqlite3 production: <<: *default database: db/production.sqlite3 and getting following error in browser : no database file specified. missing argument: database the full trace looks : `activerecord (4.1.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:14:in `sqlite3_connection' activerecord (4.1.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:435:in `new_connection' activerecord (4.1.0) lib/active_record

nopcommerce - how to call insert method when click on product? -

i want display 10 viewed product in category page made insert method in nopcommerce_3.20_source\libraries\nop.services\catalog\productservice.cs public virtual void insertmostviewproduct(mostviewproduct product) { if (product == null) throw new argumentnullexception("product"); //insert _mostviewrepository.insert(product); //clear cache _cachemanager.removebypattern(products_pattern_key); //event notification _eventpublisher.entityinserted(product); } my question how should call method when click on product , entry save in database? please advise. i tracked first question displaying 10 viewed product. you have add functionality product service , in catalog controller of nop.web project have add called newly created method in product service in product action

ios - How to Get 4lat & Long corner points of any country using maps -

i 4 lat & long values of country, suppose let me take india, india need east, west, north & south coordinates, can calculate 4 points centre point zoom or please suggest me idea, how zoom country wise, if name given need particular country find country in openstreetmap using search facility in top-left, press 'export'. press 'manually select different area', drag out rectangle enclose country. see 4 extremes of latitude , longitude displayed in top-left of screen.

c - how to reuse the variable in linux kernel? -

extern unsigned long current_rx_time; export_symbol(current_rx_time); int netif_rx(struct sk_buff *skb) { current_rx_time = jiffies; } i modified kernel source code in dev.c shown above. later creating loadable kernel module in procfs , using currentrx_time send user space shown below : static int my_proc_show(struct seq_file *m, void *v) { //i printing value below seq_printf(m, "%lu\n", current_rx_time *1000/hz); return 0; } but getting error when compile module above current_rx_time undeclared. tell me how solve problem? first need declare variable , can export it. so declare in dev.c unsigned long current_rx_time; then export in dev.c export_symbol(current_rx_time); and in other loadable module want use (let's in temp2.c)... extern unsigned long current_rx_time; now make sure when going compile temp2.c @ time dev.c getting compile.

java - How to set delay time for the AsyncTask execution when it uses also another Thread? -

i set delay time in milliseconds class extends asynctask. class using java thread. there classes stream mjpeg on android few changes question: android ics , mjpeg using asynctask this class extends asynctask: public class getcameramjpeg extends asynctask<string, void, mjpeginputstream> { @override protected mjpeginputstream doinbackground(string... params) { try { url url = new url(params[0]); httpurlconnection connection = (httpurlconnection) url.openconnection(); connection.setrequestmethod("get"); if (username != null && password != null) { string authencoded = base64.encodetostring((username + ":" + password).getbytes(), base64.default); connection.setrequestproperty("authorization", "basic " + authencoded); } connection.connect(); return new mjpeginputstream(connection.getinputstream());

c# - Thread Synchronisation : Threads having their own copy of string type lock -

recently came across code following: void callthisindifferentthreads(return return) { var lock = "lock"; lock(lock) { //do here. } } my first reaction lock in code won't work because creating lock , using in same method. every thread calling method has it's own copy of lock there no synchronisation. but later realized should work because string goes string pool , there 1 instance of particular string. i'm not sure if i'm correct. locking on strings super bad . don't it. have no guarantee other clever soul not lock on strings, , because "super" global because of string interning, moment becomes accepted practice, wheels fall off. lock private object has 1 purpose... locking. strings don't fit description. locking string. safe/sane? is ok use string lock object?

mysql - Joining three tables in SQL, Inner join does not work properly -

we have 3 tables, document , department , contact . all tables linked 'id' column. want result follows firstname lastname address upload_date department_name the below query fetches first 4 columns select contact.firstname, contact.lastname,contact.address , document.upload_date contact join document on document.id= contact.id , contact.status = 1 , document.defaultdoc=1 so it's inner join. but fetch last column, department_name added similar join contact.deptid=department.id , query returns 0 results. wrong ? if add join department on contact.deptid=department.id it should work.

ssl - server giving msxml3.dll error '80072f7d' when trying to access secure url -

for years have used classic asp connect secure site of supplier using msxml3.dll - since morning, getting; msxml3.dll error '80072f7d' error occurred in secure channel support i have had around , can see not 1 have seen - cannot find solution. the partner site has updated ssl certificate. if try connect remote url server using ie or chrome, fails connect reporting nonvalid digital signature on site's certificate. however, if try connect local computer, works without problem , can see server identity has been correctly established. any appreciated. in microsoft windows server 2003, applications use cryptography api (capi) cannot validate x.509 certificate. problem occurs if certificate secured secure hash algorithm 2 (sha2) family of hashing algorithms. applications may not work expected if require sha2 family of hashing algorithms. http://support.microsoft.com/kb/938397 fixed problem me.

git - How to properly set permission for github webhook -

i have set github webhook server auto pull specified branch repo. make work made www-data owner of repo files on server (else won't able write files). but read it's bad let www-data owner of files. case? if yes how can setup properly? thanks helping!

timedelta - How can I accurately display numpy.timedelta64? -

as following code makes apparent, representation of numpy.datetime64 falls victim overflow before objects fail work. import numpy np import datetime def showmedifference( t1, t2 ): dt = t2-t1 dt64_ms = np.array( [ dt ], dtype = "timedelta64[ms]" )[0] dt64_us = np.array( [ dt ], dtype = "timedelta64[us]" )[0] dt64_ns = np.array( [ dt ], dtype = "timedelta64[ns]" )[0] assert( dt64_ms / dt64_ns == 1.0 ) assert( dt64_us / dt64_ms == 1.0 ) assert( dt64_ms / dt64_us == 1.0 ) print str( dt64_ms ) print str( dt64_us ) print str( dt64_ns ) t1 = datetime.datetime( 2014, 4, 1, 12, 0, 0 ) t2 = datetime.datetime( 2014, 4, 1, 12, 0, 1 ) showmedifference( t1, t2 ) t1 = datetime.datetime( 2014, 4, 1, 12, 0, 0 ) t2 = datetime.datetime( 2014, 4, 1, 12, 1, 0 ) showmedifference( t1, t2 ) t1 = datetime.datetime( 2014, 4, 1, 12, 0, 0 ) t2 = datetime.datetime( 2014, 4, 1, 13, 0, 0 ) showmedif

Execute remote exchange powershell command with C# -

i can execute powershell command on remote machine, , can execute powershell exchange snapin commands, can't figure out how both. issue resides in runspacefactory.createrunspace() method. a wsmanconnectioninfo object lets me target remote host so: wsmanconnectioninfo connectioninfo = new wsmanconnectioninfo( new uri(configurationmanager.appsettings["exchangeserveruri"]), "http://schemas.microsoft.com/powershell/microsoft.exchange", new pscredential(username, securestring)); and runspaceconfugation + pssnapininfo lets me target snapin so: runspaceconfiguration rsconfig = runspaceconfiguration.create(); pssnapinexception snapinexception = null; pssnapininfo info = rsconfig.addpssnapin("microsoft.exchange.management.powershell.admin", out snapinexception); but can feed 1 or other createrunspace(). runtime object returns has properties connectioninfo , runspaceconfiguration, they're both readonly. intentional design can't

sql - Pass stored procedure parameter values to nested stored procedure without knowing parameter names -

i trying create universal error trapping stored procedure called within stored procedures , need parameter names (i can system tables knowing stored procedure name) , values. the values need obtain , them dynamically (without having pass them stored procedure name). is there way pass unique id or other thing nested stored procedure can use parameter values main stored procedure in nested stored procedure? short example: have stored procedure: create procedure testparamaters @text1 varchar(500), @datetime1 datetime -- want able call sp this: exec dynamicerrortrackingsp (pass something, system variable/data/etc, can dynamically parameter values in nested sp) i have code similar , works fine (but have edited every sp correctly pass parameter values (i not want have edit every sp). exec dynamicerrortrackingsp @parmaternamevaluepairs = '@text1 = ' + @text1 + ', @datetime1 = ' + cast(@datetime1 varchar(500)) + '

jquery - Select List Manipulation -

this question similar @ least 1 other question, resolution didn't me. have code worked great in jquery 1.4, works no longer. have 2 buttons (used to) allow user navigate thru select list. here's working version: http://jsbin.com/weput/1/ <!doctype html> <html> <head> <meta charset="utf-8"> <title>js bin</title> </head> <body> <button onclick="setoption(-1)">&#8592;</button> <button onclick="setoption(1)">&#8594;</button> <select name="select1" id="select1"> <option value=""></option> <option value="one">one</option> <option value="two">two</option> <option value="three">three</option> </select> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>

java - Array Index out of bounds think there is a specfic line -

exception in thread "main" java.lang.arrayindexoutofboundsexception: 100 @ ham.main(ham.java:34) line 34 on console says if (h[c] == 1) i wrote code generate hamming code..i getting javaindexoutbounds exception..i gave absurdly large array sizes counter tht..still not working! array outbounds thou there plenty of space array the line 27 might mistake...checking c import java.util.*; public class ham { public static void main(string ar[]) { scanner s = new scanner(system.in); system.out.println("input no. of bits"); int n = s.nextint(); int a[] = new int[100]; // user's input int h[] = new int[100]; // hamming code array system.out.println("i/p data"); int = 1, j = 1, pb = 1; (i = 1; < n + 1; i++) a[i] = s.nextint(); = 1; while (i < n + 1) { if (j == pb) // if index parity bit leave { j++; pb = pb * 2; } else { h[j] = a[i];

php - Table Monthly Rankings -

Image
do have suggestions/tips on how can achieve table layout in dompdf? retrieving of data database working fine problem how can achieve required table layout. here table output sample: here's have/tried far: <table class="ormexsum2" cellpadding="0" cellspacing="0" border="1" width="100%"> <thead> <tr><th colspan="14">monthly rankings</th></tr> <tr> <th width="10%">location</th> <th width="22.5%">negative snippet</th> <?php $year = (date('y')-1); $curyear = date('y'); $start = new datetime("dec 1, $year"); $end = new datetime("dec 31, $curyear"); $interval = dateinterval::createfromdatestring('fourth friday of next month'); $period = new dateperiod($start, $interval, $end, da

ruby - How to push seeds.rb to existing rails app (on Heroku)? -

i store app's data in seeds.rb locally. however, after pushing heroku, app works well, without data. not want re-input mass data again, have ways me? if push app heroku, can seed database following command. heroku run rake db:seed

Google Drive not persisting PUT changes -

to google: 1) have app uses google api javascript client. prior today, able save changes existing user file that's saved on drive. however, if send put request https://content.googleapis.com/upload/drive/v2/files updated file contents, still 200 response, new file contents not persisted. (fetching file again on page refresh shows old file state.) none of app's code has changed since last working on sunday. i feel related file revisions suspect behavior? , google drive api file update new possible bug . should bug report, unable find submit google drive sdk support page says come stackoverflow. update : there's thread on google+ site google drive developers regarding issue. 2) there webpage has information on when google makes api updates and/or changes break functionality? happened last week: google drive sdk giving access users files , affected app. stackoverflow best place learn these things?

sql server - Return value of SQLCMD RESTORE in cmd batch -

i building cmd script restore sql server database, , need know if restore worked correctly, in order perform other tasks. code: sqlcmd -s %database_server% -u user-p password-q "restore database %database% disk='i:\bakup.bak'" thanks backup command doesn't return error code. moreover, backup error can found in error log only, not in of system catalogs. there table msdb.dbo.backupset information on successful backups, though, , can used deduce whether backup errored or not. make note of current time prior taking backup, , after backup finishes use query retireve time of last successful backup: select max(backup_start_date) msdb.dbo.backupset database_name = 'database_name' if time returned less 1 recorded there errors.

ios7 - iOS: UICollectionView - Jerks while scrolling -

i have 3 item in single row. every item quite customized. on start load 6 item means 2 rows. when scroll , reaches end of send row load 3 row. between show jerk of mili seconds. is there way load minimum 5 rows. if user scroll 2nd row load 6th row , on... please help.. if trying load network resources in uitableviewcell , better asynchronize loading resources. if try load 6th row when scroll 2nd row. guess uitableviewcell visiblecells way load more cells' resources in advance .

ios - Problems setting position of CAShapelayer -

i have posted similar question before didn't feel got correct answer. want change position of cashapelayer position of touch located when touch moved. i'm using code can see down below. problem have animation work, not touch located. instead 20 pixels away. there way fix this? -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event { nsset *alltouches = [event alltouches]; uitouch *touch = [alltouches objectatindex:0]; cgpoint currentpos = [mytouch locationinview: self]; layer = [self addcircleyellownwithradius:8 withduration:5 x:currentpos.x y:currentpos.y]; } -(void)touchesmoved:(nsset *)touches withevent:(uievent *)event { nsset *alltouches = [event alltouches]; uitouch *touch = [alltouches objectatindex:0]; cgpoint currentpos = [mytouch locationinview: self]; //set layer posotion touch position layer.position = cgpointmake(currentpos.x-8,currentpos.y-8); } -(cashapelayer *)addcircleyellownwithradius:(float)radius5 withduratio

scala - How do I verify mockito calls in asynchronous methods -

i'm writing highly asynchronous bit of code , i'm having problems testing using specs2 , mockito. problem matchers executed before asynchronous code executes. see specs2 has await , eventually helpers - promising i'm not sure how use them. below stripped down example illustrates problem sut package example.jt import scala.concurrent._ import executioncontext.implicits.global import scala.util.{try, success, failure} trait service { def foo def bar def baz } class anothertest(svc: service) { def method(fail: boolean) { svc.baz future { thread.sleep(3000) pvt(fail) oncomplete { case success(_) => svc.foo case failure(ex) => svc.bar } } } private def pvt(fail: boolean):future[unit] = { val p = promise[unit] future { thread.sleep(2000) if (fail) p failure (new runtimeexception("failure")) else p success () } return p.future } } specs2

c# - Are the AES legal key sizes really the limit? -

the aescryptoserviceprovider.legalkeysizes field shows allowed sizes in bits. however don't understand if true, how able utilise 2048 bit key length (256 bytes)? i suppose real question is, key produced size requested (larger max 32 byte), first 32 bytes (256 bits) taken in encryption/decryption process, rendering larger key size waste of space? i don't know if there way of telling what's exposed in api... any thoughts? maybe i'm looking @ in wrong way? aes can used 3 key sizes: 128, 192 , 256 bit keys. if able use larger keys 256 bit, library "lying you" i.e. bits of larger key discarded or compressed somehow. instance php mcrypt cuts size of key down largest possible size. larger key "seeds" rather common in world of cryptography. instance diffie-hellman - key agreement algorithm - generates secret larger key size required. question of extracting (concentrating) amount of entropy in key arises. if bits truncated entropy in

pdf - iTextSharp - when extracting a page it fails to carry over Adobe rectangle highlighting important info -

per following site... http://forums.asp.net/t/1630140.aspx?extracting+pdf+pages+using+itextsharp ...i use function extractpages produce new pdf based on range of page numbers. problem noticed pdf had rectangle on 2nd page not extracted along page. causes me fear perhaps adobe comments not being carried on pages extracted. is there way can adjust code take consideration bring on comments , objects rectangles new pdf when extractpages called? missing syntax or not available version 5.5.0 of itextsharp? your use of verb extract in context of extracting pages confusing. people think want extract text page. in reality, want import or copy pages. the example refer uses pdfwriter . that's wrong: should use pdfstamper (if 1 existing pdf involved) or pdfcopy (if multiple existing pdfs involved). see answer question how keep original rotate page in itextsharp (dll) find out why example on forums.asp.net really, bad example. the fact page has "a rectangle

html - Styling <button> with <i> icon and text in Chrome/Firefox -

Image
i have <button> tag have <i> element displaying icon before text. here's html <button> <i></i> login using facebook </button> the inside <i> displaying icon. other tag <a> , can use :before pseudo-class display icon, seems can not <button> tags. and here's css button { background: #4a6ea9; color: #fff; font-weight: bold; line-height: 24px; border: 1px solid #4a6ea9; vertical-align: top; } button { background: url('http://icons.iconarchive.com/icons/danleech/simple/24/facebook-icon.png'); display: inline-block; height: 24px; width: 24px; border-right: 1px dotted #fff; } here's fiddle http://jsfiddle.net/petrabarus/sdh3m the first initial display in chrome 28.0.1500.95 linux below looks little bit imbalance on top , bottom (i'm not designer nor front-end engineer can sense it's quite imbalance), can add padding padding: 4px 6px