Posts

Showing posts from March, 2011

Move SQL Server database from one server to another -

we using several servers sql server 2008. want move database 1 server server. did following process // #1 detach database on first server // #2 physically copy database , log file new server // #3 attach database on new server our method did not work, last step failed on new server error msg below bb error occurred while processing log database 'dbtest' if possible, restore backup. if backup not available, might necessary rebuild log. not open new database 'dbtest'. create database aborted any change recover current files, because can these files again / backup version of database files ? not know how rebuild log files? can not attach them :-( given experiencing error, recommend trying attach files original server , see if errors. if copied versions won't attach, may have been corrupted in way. if still have original version of files on source server, try attaching them again see if error. if don't error, can recopy fi

javascript - How to Associate an Object with a DOM Element -

i have master object in js setup, i.e.: var mygarage = { cars: [ { make: "ford", model: "escape", color: "green", inuse: false }, { make: "dodge", model: "viper" color: "red", inuse: true }, { make: "toyota", model: "camry" color: "blue", inuse: false } ] } now loop on cars , put them in table. in table have button lets me toggle car "in use" , "not in use". how can associate dom element of every row corresponding car, if toggle "inuse" flag, can update master object? i'd suggest considering addeventlistener , , constructor conforms objects eventlistener interface. that way can have nice association between object, element, , handlers. to thi

java - Measure the timing of user screen touches -

i developing app android in taking vibration pattern user using screen touches , saving in array. e.g long[] pattern = {100, 200,150}; first 100ms vibrate next 200ms not vibrate vibrate next 150ms. want create values depending on user input. i using timer class, , save time spent between 2 touches user. being novice in java not able figure out how implement above logic, convert user touch pattern in above array. any other more efficient logic welcome. i start subclassing view , overriding touch event methods allow great deal of control: @override public boolean dispatchtouchevent(motionevent ev) { return super.dispatchtouchevent(ev); }; @override public boolean ontouchevent(motionevent ev) { return super.ontouchevent(ev); } @override public boolean onintercepttouchevent(motionevent ev) { return false; } after have have local variable records time of each touch event, calculate delta time.

RVM Ruby with TK installation (OSX) -

i'm trying install ruby tk support. using rvm, did this: rvm install 1.9.2 -c --enable-shared --enable-pthread the installation appears work fine, , can see called .rvm/src/ruby-1.9.2-p320/ext/tk/tcltklib.c which assume library need? i try run require 'tk' in irb, error message loaderror: no such file load -- tk any ideas? update: fixed! if interested in complete list of steps ruby upgrade 2.0.0 tk support on osx, did: install rvm ruby - \curl -#l https://get.rvm.io | bash -s stable --autolibs=3 --ruby install tk activetcl - http://www.activestate.com/activetcl run rvm reinstall 2.0.0 --enable-shared --enable-pthread --with-tk --with-tcl fire irb , check tk installation successful with require 'tk' rvm disables tk/tcl default (problems on os x), need tell ruby (via rvm) want tk/tcl: rvm install 1.9.2 --enable-shared --enable-pthread --with-tk --with-tcl

sql - Formatting a Field Whenever it's Queried -

i have rails app acts back-end iphone app. whenever record, let's call message , created, format string coming iphone app ruby datetime saved field in database. string converted nsdate on iphone side. problem want convert datetime string can formatted nsdate whenever query sent messages. there simple solution this? the view idea not bad one, might suggest putting date_string attribute on message model this: class message def date_string date.to_s # or want format end end then, when render json, include date_string . don't know you're using render json, i've had pretty great experience rabl .

Inserting an Online Picture to Excel with VBA -

i'm working on project , need fill in cells pictures via urls. urls in 1 column, , i'd load images in adjacent column. i'm no vba expert, found code worked, reason error (usually 5 images in) says: run-time error '1004': unable insert property of pictures class again, i'm using system urls in 1 column i.e.: xxxx.com/xxxx1.jpg xxxx.com/xxxx2.jpg xxxx.com/xxxx3.jpg xxxx.com/xxxx4.jpg through searching, found linked excel version (using 2010), though i'm not sure. here's current code i'm using: sub urlpictureinsert() dim cell, shp shape, target range set rng = activesheet.range("a5:a50") ' range urls each cell in rng filenam = cell activesheet.pictures.insert(filenam).select set shp = selection.shaperange.item(1) shp .lockaspectratio = msotrue .width = 100 .height = 100 .cut end cells(cell.row, cell.column + 1).pastespecial next end sub any appreciated! or

c# - Retrieve specific table element from open xml Word document mainpart -

i need specific table's xml open xml document innertext == "something" & "somethingelse" example : using (wordprocessingdocument doc = wordprocessingdocument.open(path, false)) { maindocumentpart mainpart = doc.maindocumentpart; string xml = mainpart.document.descendants<table>().select // innertext == "this" || innertext == "that" console.writeline(xml); maindocumentpart documentprincipal = document.maindocumentpart; documentprincipal.document.innerxml = documentprincipal.document.innerxml.replace(replacethisby, that); documentprincipal.document.save(); document.dispose(); } how achieve ? many thanks. if question of replacing text in table, there several ways can go it. if have control on document replacing in, can bookmark text want replace, use this public void replaceinbookmark(bookmarkstart bookmarkstart, string text) { openxmlelement elem = bookmarkstart.nexts

html - Javascript Radio Buttons Functionality bug -

i'm try couple things radio buttons form, , i'm having lot trouble. there 2 radio buttons right now, work together. want have 3 scenarios form. neither of radio buttons checked, hide or disable 2 other elements. (text box , dropdown list) the first radio button checked, hide or disable 1 element. the second radio button checked, hide or disable 1 element. in 3 scenarios need form return values user, whether nothing, or radio button check , element available radio button. please keep in mind form contain other radio buttons later on separate these. mention want keep in plain javascript if possible. currently i'm trying use .disable , .checked, not luck. please me figure out. please include explanation of answer if possible can understand it. here forms code : <input type="radio" name="clubmember" id="member" value="member" />club member <input type="radio" name="clubmember" id="nonme

actionscript 3 - Error with jump function when putting script on movieclip -

i'm having problem jump function platformer engine. i've moved of hit testing onto individual platforms in level, don't have write things out each individual one. problem first movieclip added stage can jumped on to. others make player sink through floor if held down (as should- he's not meant there there's nothing stop him). problem check jump isn't registering on second block. here's code (sorry excessive movieclip(parent) s) var playerref:movieclip = movieclip(parent).player; stage.addeventlistener(event.enter_frame, hitupdate); function hitupdate(e:event):void { if (playerref.hittestpoint(playerref.x,this.y - (playerref.height/2)) && playerref.x + playerref.width > this.x && playerref.x < this.x + this.width && !movieclip(parent).updown) { movieclip(parent).downmomentum = 0; playerref.y = this.y - playerref.height; } if (playerref.hittestpoint(playerref.x,this.y + this.height) &&

Is It Possible To Replace Fringe Bitmaps With Text in Emacs? -

i'd love replace ugly pixel arrows indicating truncated or wrapped lines simple, tasteful text (maybe nice unicode character, \u2026 ellipsis). possible? no, not. fringe “bitmaps” bitmaps, vectors of 0/1 bits, overlayed on fringe. there no way directly render arbitrary unicode characters onto fringe. what can do, render unicode character 0/1 bitmap yourself. decent image editor (e.g. gimp, photoshop, pixelmator, paint.net, etc.) can this. convert bitmap fringe bitmap vector. format of fringe bitmaps described in customizing fringe bitmaps . eventually can use these bitmap vectors replace left-arrow , right-arrow (for truncated lines), left-curly-arrow , , right-curly-arrow (for continued lines) bitmaps, using function define-fringe-bitmap . however, i'd more hassle worth. fringe 8 pixels wide, you'd have squeeze beautiful unicode character 8x8 bitmap. means no subpixel rendering, no aliasing, no bytecode rendering, nothing of makes characters on

html - CSS:Can't select text of child with user-select:auto, while parent has user-select:none -

i trying code input form instructions throughout. text not selectable, of course input selectable users can modify text easily. my html looks this: <div id="form"> <header> header text </header> instructions on do. <form> <label>first name:</label><input type="text" name="fname" /> <label>last:</label><input type="text" name="lname" /> <label>email:</label><input type="text" name="email" /> </form> <div id="extras"> bunch of separate notes , maybe textarea box</div> </div> and css looks this: #form{ user-select:none; } #form form input{user-select:auto} a couple of notes: included css various browsers in actual code. tried user-select:text, , did not work. have many bits of text separated different sections, prefer remove ability select default behavior , apply ability select inputs. applyi

javascript - AngularJS - Asynchronous call to Facebook API -

i'am trying call facebook api angularjs. the problem calls fb api asynchronous, need know when query on facebook avaliable use in agularjs. for this, call method in controller: facebook.getloginstatus(); which facebook service, defined as: app.factory('facebook', function() { getloginstatus: function() { fb.getloginstatus(function(stsresp) { console.log(stsresp); if(stsresp.authresponse) { // user logged in return true; } else { // user not logged in. return false; } }); } } what want in case check if user logged. if true, i'll show options, otherwise, i'll show login button. i've try use $q.defer() functions, promises, factorys watch response data, everything. works want. i've checked development examples based on egghead.io examples, think i'm not understand asynchronous calls in angular

Google Drive on android error: java.lang.IllegalArgumentException: the name must not be empty: null -

i got stuck "java.lang.illegalargumentexception: name must not empty: null" exception on google drive android app. i have been googling several day without getting clue. code (an easy example) file list on google drive: (it taken here: google drive sdk exception ) import java.io.ioexception; import java.util.arraylist; import android.accounts.account; import android.accounts.accountmanager; import android.app.activity; import android.app.progressdialog; import android.content.context; import android.content.dialoginterface; import android.content.intent; import android.os.asynctask; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.button; import com.google.android.gms.auth.googleauthexception; import com.google.android.gms.auth.googleauthutil; import com.google.android.gms.auth.userrecoverableauthexception; import com.google.android.gms.common.accountpicker; import com.google.api.client.auth.oauth2.bearertoken; impo

Apache load balancer And JBoss -

i using apache load balancer 2.1 jboss have configured 10 jboss nodes managed apache load balancer. there console available in apache load balancer manage these nodes , see how many users handled each of these nodes when there load on environment? there jkmanager console. not mind blowing, quite useful. see: http://tomcat.apache.org/connectors-doc/generic_howto/loadbalancers.html http://www.gesea.de/en/techdocs/admin/tomcat/jkmanager-apache-mod_jk-loadbalancer-status-monitor.htm

c++ - passing a stringstream to istream using operator >> -

i trying pass stringstream object(class) has overloaded extraction operator >> declared , defined. example, declaration overloaded extraction operator in object1 is friend istream& operator >>(istream& in, object1& input); in object2, declaration same friend istream& operator >>(istream& in, object2& input); during object1 extraction function, func. gets line, turns stringstream , tries use extraction(>>) operator of object2. istream& operator >>(istream& in, object1& input){ object2 secondobj; string data; string token; in>>data; in.ignore(); token = gettoken(data, ' ', someint); //this designed take part of data stringstream ss(token); // copied token ss ss >> secondobj; // run problems. } i error no match operator >> . because need convert stringstream istream? if so, how that? the minimal program this: in main.cpp: #include "o

java - Null check emitted for 'this' access? -

when access own instance field via this reference (for example, object or int field private method), generated android dalvik bytecode contain iget bytecode instruction: iget v2, p0, lcom/example/myapp/myclass;->status:i this same instruction emitted when access object's field (i.e. not via this pointer), doesn't seem distinguish between other objects , yourself. in bytecode, understandable, jit more. checking android source code, don't see null check automatically eliminated jit such cases (i.e. when access this ). eliminated in basic blocks already-null-checked dalvik registers, fine, (to me) seems eliminated this access (even if it's first instruction of basic block, or instruction, this cannot null). what missing? security/runtime typesafety reasons? or overlook source code? why cannot vm (jit) handle this in distinguished way? (i understand native code can't, because this memory address else.) edit: far can see, "already-null-c

CSS Skew Jagged Edges on iPad -

i have site uses css skews extensively part of design. using backface-visibility solved jagged edge problem, except on ipad. in every other webkit browser, iphone included, edges smooth, reason ipad not behaving. here code skew: -webkit-backface-visibility: hidden; -ms-backface-visibility: hidden; -moz-backface-visibility: hidden; backface-visibility: hidden; overflow: hidden; -webkit-transform: skewx(16deg); -moz-transform: skewx(16deg); -ms-transform: skewx(16deg); transform: skewx(16deg); /* ie8+ */ -ms-filter: "progid:dximagetransform.microsoft.matrix(m11=1, m12=0.28674538575880865, m21=0, m22=1, sizingmethod='auto expand')"; /* ie6 , 7 */ filter: progid:dximagetransform.microsoft.matrix(m11=1, m12=0.28674538575880865, m21=0, m22=1, sizingmethod='auto expand'); this site: acumen.org -webkit-backface-visibility: hidden; -ms-backface-visibility: hidden; -moz-backface-visibility: hi

Applying a set of operations across several data frames in r -

i've been learning r project , have been unable google solution current problem. i have ~ 100 csv files , need perform exact set of operations across them. i've read them in separate objects (which assume improper r style) i've been unable write function can loop through. each csv dataframe contain information, including column dates in decimal year form. need create 2 new columns containing year , day of year. i've figured out how manually find way automate process. here's i've been doing: #setup library(lubridate) #used check leap years df.00 <- data.frame( site = seq(1:10), date = runif(10,1980,2000 )) #what need done df.00$doy <- na # make empty column i'm going place day of year df.00$year <- floor(df.00$date) # grabs year date column df.00$dday <- df.00$date - df.00$year # year fraction. intermediate step. # multiply fraction year 365 or 366 if it's leap year give me day of year df.00$doy[which(leap_year(df.00$year))]

sql - Rails joins through association -

in ruby on rails, want find employers in city. lets models set way: city has_many :suburbs has_many :households, :through => suburbs has_many :people, :through => suburbs suburb has_many :households has_many people, :through => households belongs_to :city household has_many :people belongs_to :suburb people belongs_to :household belongs_to :employer employer has_many :people i feel want sort of employer joins some_city.people don't know how this. if people belonged directly cities, join employer people city_id something, want find same data without direct join , little lost. thank you. you can join jvans has illustrated. or can setup relationships following: class employer < activerecord::base has_many :people has_many :households, through: :people has_many :suburbs, through: :households has_many :cities, through: :suburbs end class person < activerecord::base belongs_to :household belongs_to :employer end class household &l

Groovy equivalent to Scala trait stackable modifications? -

i have been going through programming scala book(by martin odersky,lex spoon,bill venners ed1) , came across traits. section find interesting stackable modifications. example used abstract class intqueue { def get(): int def put(x: int) } trait incrementing extends intqueue { abstract override def put(x: int) {super.put(x+1)} } trait filtering extends intqueue{ abstract override def put(x: int){ if(x >=0) super.put(x) } } so example provided has concrete class "basicintqueue extends intqueue follows import scala.collection.mutable.arraybuffer class basicintqueue extends intqueue{ private val buf = new arraybuffer[int] def get() = buf.remove(0) def put(x: int) {buf +=x} } scala> val queue = (new basicintqueue incrementing filtering) scala> queue.put(-1);queue.put(0);queue.put(1) scala> queue.get() = 1 so example shows both filtering , incrementing "chained" , executed before elements "put" queue. i wondering

breeze - Can't get .vsix to install in Visual Studio 2010 or 2012 -

i downloaded breeze / angular js template part of r/d day work: http://www.asp.net/single-page-application/overview/templates/breezeangular-template double-clicking .vsix file opened visual studio 2012, read-only binary file ( if anyone's familiar hxd, or similar hex editors, looks kinda ). tried open visual studio 2010, got same result. i tried opening extensionmanager in vs 2010, found nothing importing template. tried extensions , updates in vs 2012 ( equivalent of extensionmanager ) , not find importing template there either. i found nothing on google regarding problem i'm having. is there different default program supposed handle .vsix files ( eg. open with... sort of visual studio installer or )? if has solution frustrating dilemma, that'd grand. also, pitching computer out window unfortunately not option me. the templates work on vs 2012 r2. this noted (with no fanfare) in several places. here quote ms angular spa template page : the b

How do I work with a LEGACY database in Rails? -

i'm working on rails web site profiles stock mutual funds , etfs. have separate ruby script runs nightly , populates postgres database data on these mutual funds , etfs. chapter 6 of rails tutorial isn't quite i'm looking for. differences between i'm trying , chapter 6 of rails tutorial are: 1. in rails site, there no need create database, because has been populated. don't think need use "rails generate" or "rake db:migrate". (or wrong?) 2. rails site reads data , not add, delete, or edit data. you don't have create migrations. create models. if database table not match model name, can use set_table_name older versions of rails or self.table_name = 'table_name' newer versions. if don't use rails standard foreign keys , primary keys, you'll have specify well. for example: # assuming newer versions of rails (3.2+, believe) class etf < activerecord::base self.primary_key = 'legacy_id' se

c++ - C union char array prints 'd' on mac? -

i new c/c++, curious know issue seeing. typedef union { int a; float c; char b[20]; } union; int main() { union y = {100}; printf("union y :%d - %s - %f \n",y.a,y.b,y.c); } and output is union y :100 - d - 0.000000 my question ...why 'd' getting printed? changed order in union still same output. if declare char f[20] outside union nothing gets printed. having macbook lion image , using xcode. in advance i changed order in union still same output. the order of elements in union doesn't change because elements of union use same piece of memory. code prints 100 y.a , d y.b because both expressions interpret same bytes. so, example, if add line sets y.b , prints again: union y = {100}; printf("union y :%d - %s - %f \n",y.a,y.b,y.c); y.b = 'f'; printf("union y :%d - %s - %f \n",y.a,y.b,y.c); you'll see y.a , y.c. change whenever y.b changes, , vice versa. y.a should change 102 in secon

vb.net - How to fill empty textboxes with some value while updating database? -

i have form containing 6 groupboxes , 120 textboxes. during data updation data base, empty textboxes return value "-na-". tried following codes keep getting errors: integer = 1 20 if groupbox1.controls("collartb" & i).text = string.empty groupbox1.controls("collartb" & i).text = "-na-" end if if me.groupbox1.controls("collartb" & i).text = string.empty me.controls("collartb" & i).text = "-na-" end if if form9.controls(i).text = string.empty form9.controls(i).text = "-na-" end if next if frnttb1.text = string.empty frnttb1.text = "-na-" how can done? solutions please? also, have containing 180 textboxes in groupbox. want populate them single row of database @ once. possible? if so, how? you can use linq filter groupboxes form , in groupboxes can filter o

ruby on rails 3 - DRYup shared model validations on before_destroy -

to prevent removal of related records, applying before_destroy callbacks approach on each model i defined several related-records validation methods in module, can shared different models' before_destroy callbacks: class teacher < activerecord::base include relatedmodels before_destroy :has_courses ... end class level < activerecord::base include relatedmodels before_destroy :has_courses ... end module relatedmodels def has_courses if self.courses.any? self.errors[:base] << "you cannot delete while associated courses exists" return false end end def has_reports if self.reports.any? self.errors[:base] << "you cannot delete while associated reports exists" return false end end def has_students if self.students.any? self.errors[:base] << "you cannot delete while associated students exists" return false end end ... end but doesn

java - What should be the file upload path for CommonsMultipartFile if I want to save the files in the project path? -

i want upload file project relative path. webapp/fileupload/ path want file upload. so when give path commonsmultipartfile commonsfile = user.getimage(); string filename = commonsfile.getoriginalfilename(); file destfile = new file("http://localhost:8080/springdemo/fileupload/",filename); its giving me java.io.filenotfoundexception: http:\localhost:8080\springdemo\fileupload\design.txt(the filename, directory name, or volume label syntax incorrect) i not understanding should right path. i want save under project folder , not on other path using http:\localhost:8080\springdemo\fileupload\as path. when paste http://localhost:8080/springdemo/fileupload/abc.txt browser shows me file.(abc.txt) i not understanding should right path. kindly suggest me right way this. thanks in advance. zingo first off, files save within context lost if undeploy app, make sure that's want. as question, http://localhost/etc/and/so/on url app, not file pa

Android:How to download the File from the server and save it in specific folder in sdcard -

i have 1 requirement in android application. need download , save file in specific folder of sdcard programmatically. have developed source code.. and code string downloadurl = "http://myexample.com/android/"; string filename = "myclock_db.db"; downloaddatabase(downloadurl,filename); // , method public void downloaddatabase(string downloadurl, string filename) { try { file root = android.os.environment.getexternalstoragedirectory(); file dir = new file(root.getabsolutepath() + "/myclock/databases"); if(dir.exists() == false){ dir.mkdirs(); } url url = new url("http://myexample.com/android/"); file file = new file(dir,filename); long starttime = system.currenttimemillis(); log.d("downloadmanager" , "download url:" +url); log.d("downloadmanager" , "download file name:" + filename); url

android - implementation of jeremy feinstein's SlidingMenu -

i'm trying develop application using jeremy feinstein's slidingmenu library. have done in right way described in github instructions. working well, problem when click on action bar home button open slider covers complete screen. want open in half open in facebook slider in facebook app. code below: public class mainactivity extends slidingfragmentactivity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //hide title bar getsupportactionbar().setdisplayshowtitleenabled(true); //enable home button getsupportactionbar().sethomebuttonenabled(true); //home display getsupportactionbar().setdisplayhomeasupenabled(true); // getsupportactionbar().setnavigationmode(actionbar.navigation_mode_tabs); setbehindcontentview(r.layout.menu_frame); //slidingmenu menu=getslidingmenu(); slidingmenu menu=new slidingmenu(this); //menu = new sli

mkmapview - ios: addAnnotations to mapView not working -

hi have nsmutablearray annotation objects follwoing code not add annotation: in .h have @property (retain, nonatomic) marketsdatacontroller *marketlist; in .m have (adding annotations not work. nothing shows on map) _marketlist = [_marketservice.marketsdatacontroller retain]; nslog(@"%@!!!", [_marketlist objectinlistatindex:0].title); [mapview addannotation:[_marketlist objectinlistatindex:0]]; [mapview addannotation:[_marketlist objectinlistatindex:1]]; [mapview addannotation:[_marketlist objectinlistatindex:2]]; marketslistdatacontroller looks this: #import "marketsdatacontroller.h" //the following interface used private methods @interface marketsdatacontroller () - (void)initializemarketslist; @end @implementation marketsdatacontroller //set initial values instance variables - (id)init { nslog(@"init marketsdatacontroller"); if (self = [super init]) {

android - Does onReceive get called in BroadcastReceiver for AlarmManager if device is already awake -

i'm having trouble getting broadcastreceiver work. onreceive not getting called. not using service. setting alarm in activity's oncreate method. using rtc_wakeup. if device awake? onreceive called anyway? want onreceiver called if device awake. need have receiver called if device asleep want execute code receiver carries out when activity starts manually. here how starting alarm: alarmmanager = (alarmmanager) context.getsystemservice(context.alarm_service); intent = new intent(context, servicestarter.class); pendingintent pi = pendingintent.getactivity(context, 0, i, pendingintent.flag_update_current); am.set(alarmmanager.rtc_wakeup, system.currenttimemillis(), pi); in manifest: <receiver android:process=":remote" android:name=".servicestarter" android:exported="true"></receiver> but if device awake? onreceive called anyway? yes. here how starting alarm: you using getactivity() . component not activity

C++ game loading objects / global objects -

i still new c++ please forgive me if question unbearably obvious. (attempting) code rpg game. compiling nicely @ moment, have think how going load of objects (for unit classes, items etc) when game opens. i have seen threads dll's , global objects using extern's in header files, wondered practical/efficient method? (as game large) as stands, code clunky , not implemented ( did not think before trying use function declare objects in separate function , wonder why weren't accessible), should using extern rather having declare objects in main() in order instantiate them (see below). #include <iostream> #include <string> #include "unit.h" #include "uclass.h" using namespace std; // seperate function @ program start load class list. void loadclass(uclass& obj) { obj.load("peasant"); } int main() { //load classes... cout << "creating peasant...\n"; uclass peasant; loadclass(peasant);

c# - Type 'StoredProcedures' already defines a member called 'AddNumber' with the same parameter types -

i have created visual c# sql clr database project. added 2 stored procedure : test1.cs , test2.cs . have function in test1.cs addnumber . in test2.cs , want have function same name else, error after rebuild it: type 'storedprocedures' defines member called 'addnumber' same parameter types. the code test1 looks this: public partial class storedprocedures { [microsoft.sqlserver.server.sqlprocedure] public static void test1(string path) { // put code here } private static void addnumbers(int a, int b) { } }; test 2 public partial class storedprocedures { [microsoft.sqlserver.server.sqlprocedure] public static void test2(string path) { // put code here } private static void addnumbers(int a, int b) { } }; i not want change names have multiple other functions same name. also, there many variables same name in both files, too. i tried adding namespace in 1 of file while deployin

android - Two different MenuItems with different time response -

i have 2 different menu items (flipping , sharing) share single activity. each 1 of them, works , smooth own, when put them together, flipping action takes long respond. can do? help. flipping action: @override public boolean oncreateoptionsmenu(menu menu) { super.oncreateoptionsmenu(menu); // add either "photo" or "finish" button action bar, depending on page // selected. menuitem item = menu.add(menu.none, r.id.action_flip, menu.none, mshowingback ? r.string.action_photo : r.string.action_info); item.seticon(mshowingback ? r.drawable.ic_action_photo : r.drawable.ic_action_info); item.setshowasaction(menuitem.show_as_action_if_room); return true; } share action public boolean onprepareoptionsmenu(menu menu) { getmenuinflater().inflate(r.menu.share_menu, menu); menuitem item = menu.finditem(r.id.menu_item_share); mshareactionprovider = (shareactio

css - Overflow-y on scrolling div clipping nested div -

i have div scrolls horizontally hooked buttons jquery. working fine, problem have nested div in scrollable content becomes clipped overlaps container. need overflow on x axis not on y. overflow-x: hidden, overflow-y visible should solve this, doesn't. work if remove overflow, need overflow-x scroll div. simplified html / css below - without scrolling logic not problematic here.. should easy? thanks million :) andy <!doctype html> <html> <head> <title>testdiv</title> </head> <body> <div style="width:100%; height:150px; border:1px solid blue"> top div </div> <div class="slide" style="height:150px; width:800px; border: 1px solid blue; background-color: pink;"> <div style="border: 1px solid blue; width:1200px; height:150px;" class="inner" id="slider&qu

javascript - non repeating number from a range and submitting from a form to a page -

can please please? i'm needing select non repeated random number range of 1 - 80 not repeat it. rather form getting range user wish define in java script , @ press of submit button generates non repeated number in range of 1 - 80 in text area form submit, clear , result text area. here form code: <form name="generate"> <table> <tr> <td colspan="2"><input type="button" name="send_it" value="enter" onclick="chooserandom(this.form)">&nbsp; &nbsp; <input type="reset" value="clear" onclick="clearform(this.form)"><br /> <br /> </td> </tr> <tr> <td>random number:&nbsp;</td> <td><input type="text" name="result" size="5"></td> </tr> </table> </form> here java script: <script type="

node.js - Parse PHP Arrays in JavaScript -

i've php source code simple key-value arrays these: return array('var1' => 'var2' ); and return array('sub' => array( 'var1' => 'var2' ) ); and need parse them javascript objects, because i've javascript implementation of php library , want test compatibility using original test cases. there on 100 tests, manual conversion not practical. is there easy way convert these javascript objects without using php? to answer question – how parse php's associative arrays json without using php – let's use javascript code. "array('sub' => array( 'var1' => 'var2' ) );".replace(/array\(/g, '{').replace(/\)/g, '}').replace(/=>/g, ':').replace(/;/g, '').replace(/'/g, '"'); this assuming happen sit on source code , want copy node.js application, , data looks this. if data happens on multiple lines, if want parse away

php - upload file to Google drive through html form and store url in input-text box to write to mysql? -

how upload file through html form either file upload or google file picker , storing fil url mysql database ? i tried upload file through file upload , passing $file variable in below code, file uploading invalid in google drive ? <?php require_once 'google-api-php-client/src/google_client.php'; require_once 'google-api-php-client/src/contrib/google_driveservice.php'; $myfile=$_request['file']; $type=mime_content_type($myfile); $client = new google_client(); // credentials apis console $client->setclientid(''); $client->setclientsecret(''); $client->setredirecturi(''); $client->setscopes(array('https://www.googleapis.com/auth/drive')); $service = new google_driveservice($client); $authurl = $client->createauthurl(); //request authorization print "please visit:\n$authurl\n\n"; print "please enter auth code:\n"; $authcode = trim(fgets(stdin)); // exchange authorization code ac

.htaccess - match and exclude links from rewrite rule -

i know how exclude folders, file types don't know how exclude link contain specific word. have rule: rewritecond %{http_host} ^www\.domain\.com rewriterule (.*) http://en.domain.com/$1 [qsa,l] how exclude rule links have @ beginning: index.php?a=admin this should trick: rewritecond %{http_host} ^www\.domain\.com rewritecond %{request_filename} index\.php rewritecond %{query_string} !^a=admin rewriterule (.*) http://en.domain.com/$1 [qsa,l] here, we're adding condition states rewrite may occur if host www.domain.com , file being requested index.php , , query string not being a=admin . so, www.domain.com/test redirect en.domain.com/test , www.domain.com/index.php?a=admin not redirect @ all.

haskell - Lazy binary get -

why data.binary.get isn't lazy says? or doing wrong here? import data.bytestring.lazy (pack) import data.binary.get (runget, isempty, getword8) getwords = empty <- isempty if empty return [] else w <- getword8 ws <- getwords return $ w:ws main = print $ take 10 $ runget getwords $ pack $ repeat 1 this main function hangs instead of printing 10 words. the documentation linked provides several examples. first 1 needs read input before can return , looks lot have written. second 1 left-fold , processes input in streaming fashion. here's code rewritten in style: module main import data.word (word8) import qualified data.bytestring.lazy bl import data.binary.get (rungetstate, getword8) getwords :: bl.bytestring -> [word8] getwords input | bl.null input = [] | otherwise = let (w, rest, _) = rungetstate getword8 input 0 in w : getwords rest main :: io () main = print . take 10 . getwords . bl.pack . r

sequence - wso2 : ESB faultsequence -

how use faultsequence of proxy in esb i want use faultsequence when occur fault in endpoint. example stop service1 using jconsole , want route message service2 when call proxy service. when call proxy using soapui show fault message : the system attempting access inactive service.. <target> <insequence > <send> <endpoint name="cal" > <address uri="http://localhost:9763/services/service1/"/> </endpoint> </send> </insequence> <faultsequence> <log level="custom"> <property name="text" value="an unexpected error occured service"/> <property name="message" expression="get-property('error_message')"/> </log> <send> <endpoint> <address uri="http://localhost:9763/services/service2/"/> </endpoint>

PHP form, how to return error in same page rather then die() on new page? -

have been trying output errors on same page of form, using php form. <?php // first execute our common code connection database , start session require("common.php"); // if statement checks determine whether registration form has been submitted // if has, registration code run, otherwise form displayed if(!empty($_post)) { // ensure user has entered non-empty name if(empty($_post['full_name'])) { return("please enter full name."); } // ensure user has entered non-empty username if(empty($_post['username'])) { // note die() terrible way of handling user errors // this. better display error form // , allow user correct mistake. however, // exercise implement yourself. //die("please enter username."); return("pufta kollok"); }