Posts

Showing posts from July, 2010

android - How to horizontal listview scrolling control? -

in horizontal listview when swipe 1 once, scrolling working should be, need after 1 swipe, next list item shown.(just trimmedia preview in android ) you have override fling method of listview. method "fling" used emulate inertia of list when remove finger screen. if method empty, has effect scroll on next item. here example: import android.content.context; import android.widget.horizontalscrollview; public class mylistview extends horizontalscrollview { public mylistview(context context) { super(context); } @override public void fling(int velocityx) { //super.fling(velocityx); } } i didn't test it's how did in little more complex on project.

java - File is not getting uploaded to server -

i uploading audio file android application server.upload code running on side not file not getting upload on server.here code m using .i have commented code file getting uploaded .here code : public void uploadfile(string path, string id) { httpurlconnection connection = null; dataoutputstream outputstream = null; string pathtoourfile = "" + path; string urlserver = "http://txtapi.com/musicapp/uploadfile.php?fileid=" + id + "&sharedby=" + sp.getstring(commonutility.phone, commonutility.getphonenumber(ct)); string lineend = "\r\n"; string twohyphens = "--"; string boundary = "*****"; int bytesread, bytesavailable, buffersize; byte[] buffer; try { fileinputstream fileinputstream = new fileinputstream(new file(pathtoourfile)); url url = new url(urlserver); connection = (httpurlconnection) url.openconnection(); // allow inputs & outputs

mysql - Error when trying to add records to database table -

i have created system included database using mysql on visual studio express 2010. 1 of tables have included in tables booking. when tried input records tabl 'show table data' option following error: "the data in row 1 not committed error source: .net sqlclient data provider error message: string or binary data truncated statement had been terminated correct errors , retry or press esc cancel changes" i have tried inputting ('newsequentialid') default value or binding property of primary key, error still appears, , appears every other table have included in database. someone please help. @ whits end. check data want import not long each field try import. error message about. example, field 40 characters, try put 44 it.

New Facebook API fetching newsfeed and its comments -

is there way newsfeed , comments new changes facebook making on july, 2013 - https://developers.facebook.com/roadmap/ what im trying do? i want fetch latest newsfeed comments (if comments on it) one api call , if group api call. old way of doing it: 1) fetching stream table comments field (comment field deprecated now) 2) fetching graph comments field (which removed now) quick links new changes quick doc: https://developers.facebook.com/blog/post/2013/04/03/new-apis-for-comment-replies/ guide: https://developers.facebook.com/docs/graphapi/guides/comments/ fql: http://developers.facebook.com/docs/reference/fql/comment graph: http://developers.facebook.com/docs/reference/api/comment/ how using fql? no longer worry because need post_id stream: {"query1":"select post_id, actor_id, created_time, message stream filter_key in (select filter_key stream_filter uid=me() , type='newsfeed') , created_time<=now() limit 5 ","qu

asp.net - Dynamic C# Not rendering on page_load -

i have method intended dynamically generate series of divs based on entry of value dropdown list. however, wish reuse same code generate tables on first page_load when number exists. this method called. called generatetables , called page_load event: if (!ispostback) { academicprogramme programme; if (request.querystring["id"] != null) { programme = academic.getacademicprogramme(request.querystring["id"]); programmename.text = programme.name; populateview(programme); generatetables(programme.levels); } } and here method (apologies size of method): private void generatetables(int count) { (int = 1; < count + 1; i++) { literalcontrol title = new literalcontrol(); literalcontrol close = new literalcontrol(); literalcontrol close2 = new literalcontrol(); string script = "<div class=\"moduleprogtable\"><h3>l

gwt - Enabling/Disabling MGWT Button -

i'm beginner gwt , mgwt. in project i've requirement have enable , disable mgwt botton. direct method not given in current version of mgwt. i've seen in gwt button. com.google.gwt.user.client.ui.button b = new com.google.gwt.user.client.ui.button(); b.setenable(boolean); but not given in mgwt. please me,how can achieve above functionality using css/something else i not mgwt guy. , there must better solution. can try low level element manipulation: button mgwtbutton; mgwtbutton.getelement().setattribute("disabled", "disabled"); if take solution better prepare later custombutton extends mgwt button additional setenabled(boolean enabled) method have better api.

android - AdView layout takes up whole screen -

i have following xml layout: <relativelayout android:layout_width="fill_parent" android:layout_height="fill_parent"> <scrollview android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillviewport="true" android:layout_above="@+id/adcontent1" android:background="#0000ff"> <textview android:id="@+id/tempview" android:layout_width="fill_parent" android:layout_height="wrap_content"/> </scrollview> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content"

graphics - Large images with Direct2D -

currently developing application windows store real time-image processing using direct2d. must support various sizes of images. first problem have faced how handle situations when image larger maximum supported texture size. after research , documentation reading found virtualsurfaceimagesource solution. idea load image iwicbitmap create render target createwicbitmaprendertarget (which far know not hardware accelerated). after drawing operations wanted display result screen invalidating corresponding region in virtualsurfaceimage source or when needupdate callback fires. supposed possible creating id2d1bitmap (hardware accelerated) , call copyfromrendertarget render target created createwicbitmaprendertarget , invalidated region bounds, method returns d2derr_wrong_resource_domain result. reason using iwicbitmap 1 of algorithms involved in application must have access update pixels of image. the question why logic doesn't work? right way achieve goal using direct2d? far rende

c++ - OpenCV cv::Mat to short* (avoiding memcpy) -

i have c++ function called else's c# application. input function given array of signed short integers, dimensions of image represents, , memory allocated returning data, namely array of signed short integers. represent function's header: my_function (short* input, int height, int width, short* output) inside function create cv::mat input , this: cv::mat mat_in = cv::mat (height, width, cv_16s, input); this mat_in converted cv_32f , processed opencv's cv::bilateralfilter . after returns cv::mat mat_out, convert data cv_16s ( bilateralfilter accepts cv_8u , cv_32f ). need convert cv::mat mat_out array of short integers may returned calling function. code: my_function (short* input, int height, int width, short* output) { mat mat_in_16s = mat (height, width, cv_16s, input); mat mat_in_32f = mat (height, width, cv_32f); mat mat_out_cv_32f = mat (height, width, cv_32f); mat_in_16s.convertto (mat_in_32f, cv_32f); bilateralfilter (ma

How can I add two elements of same indices of two 2D arrays in python? -

i tried solve zip function , loop: mat_c=[[] in range(no_of_rows_c)] in range(no_of_rows_c): j in range(no_of_columns_c): mat_c=[a+b (a,b) in zip(mat_a,mat_b)] in range(no_of_rows_c): j in range(no_of_columns_c): print(mat_c[i][j]) numpy useful kind of thing. in particular, addition of numpy arrays performed element-wise. mat_a = np.asarray(mat_a) mat_b = np.asarray(mat_b) mat_c = mat_a + mat_b print(mat_c) without numpy, mat_c = [[a+b a,b in zip(row_a, row_b)] row_a, row_b in zip(mat_a, mat_b)]

hadoop - Pass environment variables to Hive Transform or MapReduce -

i trying pass custom environment variable executable (my-mapper.script in example below) used in hive transform eg: select transform(x, y, z) using 'my-mapper.script' ( select x, y, z table ) i know in hadoop streaming can achieved using -cmdenv example_dir=/home/example/dictionaries/ but not know how in hive transform/mapreduce. any ideas? you can wrap script simple 2 line bash script setup environment. e.g #!/bin/sh export foo=boo my-mapper.script and use script in query using 'wrapper.sh' my-mapper.script see foo (with value "boo") in environment.

asp.net - Get list of Hotels and room images from Expedia -

using asp.net want hotels , corresponding properties such hotel , room images expedia. it gives properties expect images. want hotel , room images hotel list service. should achieve this?this request var serviceclient = new hotelservicesclient("expediaserviceport"); var servicerequest = new hotellistrequest(); servicerequest.apikey = _apikey; servicerequest.locale = _culture == "tr" ? localetype.tr_tr : localetype.en_us; servicerequest.localespecified = true; servicerequest.currencycode = _culture == "tr" ? "try" : "eur"; servicerequest.suppliertype = "e"; servicerequest.searchradius = 100; servicerequest.searchradiusspecified = true; servicerequest.searchradiusunit = searchradiusunittype.km; servicerequest.searchradiusunitspecified = true; servicerequest.arrivaldate = hotellistrequest.ar

c++ - Qt Whenever pressed enter in QTextEdit -

whenever pressed enter in qtextedit it'll perform click on login button. somehow causes crash of qtcreator. how can change what'll happen if press enter in qtextedit? you need subclass qtextedit , catch event you're interested in overriding appropriate method: class mytextedit : public qtextedit { q_object public: void mytextedit::keypressevent(qkeyevent *event) { if (event->key() == qt::key_return) { login(); // or rather emit submitted() or along way } else { qtextedit::keypressevent(event); } } }; alternatively, can install event filter on text edit.

change a word in a line of text file with php -

i need change word after maildir , in exemple null of line : (the word null can word.) [3]=> string(42) "spam * ^subject: \[spam\].* maildir/.null/" i use code : if($filecontent = file_get_contents($filename)){ $repertoire = "spam"; $tab = explode("#", trim($filecontent)); $tab[3] = preg_replace("#maildir/*#", 'maildir/.'.$repertoire.'/', $tab[3]); var_dump($tab); but have string(48) "spam * ^subject: \[spam\].* maildir/.null/.spam/" how can change in maildir/.spam because .null in excess. string(48) "spam * ^subject: \[spam\].* maildir/.spam/" you can this: preg_replace('~maildir/\k\.null/(?=\.spam)~', '', $string); or word: preg_replace('~maildir/\k[\w.-]++/(?=\.spam)~', '', $string); i have tested with: $string = <<<lod spam * ^subject: \[spam\].* maildir/.null/.spam/ lod; echo preg_replace('~

sql server - SQL inner join vs subquery -

i working on following queries: query 1: select * taba inner join tabb on taba.id=tabb.id query 2: select * taba id in (select id tabb) query 3: select taba.* taba inner join tabb on taba.id=tabb.id i investigate these queries sql server profiler , found interesting facts. query 1 takes 2.312 seconds query 2 takes 0.811 seconds query 3 takes 0.944 seconds taba 48716 rows tabb 62719 rows basically asking why query 1 taking long time, not query 3. know 'sub query' slower inner join here query 2 fastest; why? if had guess it's because query 1 pulling data both tables. queries 2 , 3 (aprox same time) pulling data taba. one way check running following: set statistics time on set statistics io on when ran select * sys.objects i saw following results. sql server parse , compile time: cpu time = 0 ms, elapsed time = 104 ms. (242 row(s) affected) table 'worktable'. scan count 0, logical reads 0, physical reads 0, read-ahead re

c# - Which solutions are faster when extract content from webcrawler -

i have made web crawler using asp.net. it's work well. problem when want extract content it. of content wrap between html tags. have of solutions extract content don't know 1 better. should performance , easy implement. using regex many patterns extact content. using linq xml extract content. using xpath extract content. somebody please me choose better solutions. think go xpath not sure performance better regex or linq2xml. many ideas. none of solutions particularly good. html not regular language , such not fit regular expressions. see standard response parsing html regex. html not valid xml instead, should use html parsing library html agility pack .

c# - How Can Format Text Inside TextBoxes In WinForms -

as know in web applications there third party libraries can use convert text box editor below : tinymce win forms? how can format text inside text boxes in win forms? mean want convert regular text boxes in form editor setting property(is possible or not?). how can that? public void createmyrichtextbox() { richtextbox richtextbox1 = new richtextbox(); richtextbox1.dock = dockstyle.fill; richtextbox1.loadfile("c:\\mydocument.rtf"); richtextbox1.find("text", richtextboxfinds.matchcase); richtextbox1.selectionfont = new font("verdana", 12, fontstyle.bold); richtextbox1.selectioncolor = color.red; richtextbox1.savefile("c:\\mydocument.rtf", richtextboxstreamtype.richtext); this.controls.add(richtextbox1); }

sharepoint - How to do date and time comparision with a calculated date time value -

can check if date , time field less 15 minutes smaller or equal current date , time in workflow condition? for example, if value 5:40 pm, have check if current date , time smaller 5:25 pm condition. how can do? in sharepoint designer: create local variable. type must date/time. set it's value relevant date. now, next thing use add time date function (type "time" , choose first option (at least that's position in sharepoint designer 2010, i'm using). add 15 minutes variable. now create local date/time variable, set current date , compare both.

reporting services - Column Color Change issue in SSRS -

Image
i have issue here column operation. have 2 drilldown s particular table.i have column returns 1 (flag) on particular date. detailed row. now , on top of flag @ second level sum(flag) , returns "red" if above 3. on first level want create background change "red" if value of sum(flag) @ second level >3 or change color @ first level, if textbox color of sum(flag) "red" can please me out on this. thank you what need add grouping reference sum expressions. example: =iif(sum(fields!flag.value, "firstlevelgroup") > 3,"red",nothing) this allows control scope referencing sums. make sure modify match name of group, @ bottom of screen. make sure place expression in backgroundcolor field, not in textbox itself.

c++ - Creating a composite type from two enum classes, ready for STL map -

i create composite type out of 2 enum classes . enum class color {red, green, blue}; enum class shape {square, circle, triangle}; class object { color color; shape shape; public: }; in order use object in stl container std::map<> need overload less-than operator. however, in order flatten both enum classes 1 linear index somehow need number of elements (noe) of enum classes: friend bool operator< (const object &lhs, const object &rhs) { return noe(shape)*lhs.color+lhs.shape < noe(shape)*rhs.color+rhs.shape; } how can done without entering same information (number of elements) in 2 places in program in nice way? (nice way means no first_element, last_element , preprocessor magic, etc.) question ( number of elements in enum ) similar not address enum classes . i know best way implement kind of composite types in c++11. enum class definition strong enough, or necessary say:? enum class color {red=0, green=1, blue=2}; enum class shape {square=

graphics - Calculating Vertex Normals of a mesh -

this question has answer here: calculating normals in triangle mesh 3 answers i have legitimately done every research possible this, , says calculate surface normals of each adjacent face. calculating surface normals easy, how heck find adjacent faces each vertex? kind of storage use? missing something? why easy everyone. any guidance appreciated. but how heck find adjacent faces each vertex? think otherway round: iterate on faces , add normal of vertex. once processed faces, normalize vertex normal unit length. described in detail here calculating normals in triangle mesh if want find faces vertex, naive approach perform (linear) search vertex in list of faces. better approach maintain adjancy list.

c# - Entity Framework DbContext dynamic instatiation with custom Connection String -

migrating objectcontext dbcontext code-generation, realized context class generated (which inherits dbcontext) has no constructor receives connectionstring neither entityconnection (like objectcontext child class had). this problem in application since need instantiate context dinamically concrete type, using runtime generated connection string. any ideas? on class inherits dbcontext, should able specify base constructor takes connection sting: public class mydbcontext : dbcontext { public mydbcontext(string connstring) : base(connstring) { } } you have use sqlconnection builder though: sqlconnectionstringbuilder connbuilder= new sqlconnectionstringbuilder(dbconnstring); and use in constructor: mydbcontext dbcontext = new mydbcontext(connbuilder.tostring());

oop - C++ Vector of Subclasses, using it to overload the istream/ostream -

i'm looking hold vector of objects, of subclasses. i thought able declaring vector of pointers baseclass (such vector<baseclass*> db ), , declare subclass doing db.pushback(new subclass) (my example in link below touch different, along same lines); is possible store multiple subclasses in sense or need define new vector each subclass? in example given, there 1, realistically in program there four. if so, in overloaded >> in subclass1, dynamic casting type baseclass work call friended overloaded >> in baseclass? http://ideone.com/qm5sry edit: sorry, wasn't entirely clear in second half of question. should have expanded. i have program needs take input, , distribute throughout respective classes , subclasses. should take input cin >> class; , in case have overloaded >> operator. however, when define data subclass (lines 34 39, , line 44), appears call baseclass, rather subclass. calls friend function defined in baseclass @ line

Loading google search results(Mobile Version) in an Android WebView? -

i can load google search results in webview making request url http://www.google.com/search?q=searchterm , loading result on webview using wb.loaddatawithbaseurl(null, responsestring,"text/html", "utf-8", null); but loads pc-browser version of search results..i want mobile version...thanks try changing user agent: wb.getsettings().setuseragentstring("android");

C++ : Read/Write Binary data to file when data is complex -

how write/read data file in binary, if have define how save data? i'm attempting save simple data structures out file in binary. for example, have vector of structs this: struct vertex { x; y; z; } std::vector<vertex> vertices; i want save vector out file in binary. i know how output using ifstream , ostream using << , >> operators, can overloaded handle data, can't output binary. i know how use .write() write in binary, issue there can't find way overload need, in order handle data. here answer similar question . while ok in case, aware if using pointers in struct, not work. the pointer means : "there relevant data loaded in other memory segment", really, contains address of memory. write operation save memory location. when load back, there little chance memory still holds information want. what people create serialization mechanism. add method struct, or write function takes struct parameter , outpu

java - Arbitrary precision multiplication, Knuth 4.3.1 leading zero elimination -

i working basic knuth 4.3.1 algorithm m arbitrary precision multiplication on natural numbers. implementation in java below. problem is generating leading zeroes, seemingly side effect of algorithm not knowing whether given result has 2 places or one. example, 2 x 3 = 6 (one digit), 4 x 7 = 28 (two digits). algorithm seems reserve 2 digits results in leading zeroes. my question two-fold: (1) algorithm correct implementation of m, or doing wrong unnecessarily creating leading zeroes, , (2) if unavoidable side effect of m produces leading zeroes, how can adjust or use improved algorithm avoid leading zeroes. // knuth m algorithm 4.3.1 final public static void multiplydecimals( int[] decimalm1, int[] decimaln1, int[] result, int radix ){ arrays.fill( result, 0 ); int lenm = decimalm1[0]; int lenn = decimaln1[0]; result[0] = lenm + lenn; int istepm = lenm; while( istepm > 0 ){ int istepn = lenn; int icarry = 0; while( istepn >

silverlight - How do I add a header to a MEF call -

i have silverlight application download xaps using mef. put authorization token in header of call not able reach xaps. this: catalog = new deploymentcatalog(_uri); catalog.addheader(_header); catalog.downloadasync(); only problem there no addheader method. deploymentcatalog uses webclient under hood, doesn't seem expose in way. there's copy of source here (couldn't find on codeplex reason). uri used webclient perform asynchronous download. on completion, response used create collection of assemblies using package.loadpackagedassemblies . composition performed using assemblies. some of relevant code: //the download this.webclient.openreadcompleted += new openreadcompletedeventhandler(handleopenreadcompleted); this.webclient.downloadprogresschanged += new downloadprogresschangedeventhandler(handledownloadprogresschanged); this.webclient.openreadasync(uri, this); //composition on completion of async download var assemblies = package.loadpackagedasse

c++ - Unable to call public method of the base class from a child's instance -

i wanted try constructor inheritance in c++ , worked fine. found can't call method instance of daughter class . visual studio says the method mother::showname not available even though public, far concerned must available child class. there doing wrong? class mother{ protected: char* name; public : mother(char* _name){ name = _name; } void showname(){ cout << "my name is: " << name << endl; } }; class daughter : mother{ public: daughter(char* _name) : mother(_name) { } }; int main(){ daughter d1("masha"); d1.showname(); return 0; } class daughter : mother private inheritance. class inheritance default. class daughter : public mother you're looking for.

Rails : facebook open graph -

i creating first story in facebook graph on rails app. have created story product upload. so when user creates products, story gets published on timeline saying "user created new product sell. check out." i got code object facebook. not getting write code in app. should on product upload file new_product.html.erb or should create new file in product folder? if create new file, how load when new product gets created new_product.html.erb file calls show_product.file on product upload. how set 2 actions on creation of product? i totally new rails , facebook graph. can here? here work follow working this. for publishing story need write custom code on view file meta tag. have send post request product url. here exaple: suppose product in on http://yoursite.com/product/124 . , 1 comments on product. have following things publish story product. create action called comment object product app dashboard. write meta tag on view (like show.html.erb) head as &

sql - How to have Counts in a Join query -

i have create join between 2 tables on column , display counts of fields on joined for example here ' business ' key on want join. the first query select [business], count(*) total dimhexpand group [business] and result as: da 54100 dual 6909 ecm 1508 flex 15481 another query : select business, count (*) lodg group business order business the result of query : da 100 dual 909 ecm 508 flex 15481 i want return data joining these 2 tables show like **dimhexpand.business dimhexpand.count lodg.count** da 54100 100 dual 6909 909 ecm 1508 508 flex 15481 151481 you can join 2 tables on business column: select d.business, count(d.business) dimcount, l.lodgcount dimhexpand d left join ( select business, count (*) lodgcount lodg group business ) l on d.business = l.business group d.business; if might have different business values in each

javascript - Using pagespeed with phantomjs and jenkins integration -

i trying automate web page performance using pagespeed. is there plugin available pagespeed run on phantomjs we have yslow plugin same , working locally http://yslow.org/phantomjs/ i using command line , integrating same jenkins continous integration thanks , appreciate help some sample code phantom.create (ph) -> ph.createpage (page) -> page.open "http://www.google.com", (status) -> console.log "opened google? ", status page.evaluate (-> document.title), (result) -> console.log 'page title ' + result ph.exit() since pagespeed c++ binary, might want try integrating phantomjs netsniff.coffee (from examples ) generates har file of given page piping output har_to_pagespeed . or go pagespeed insights online service.

ruby - read xls file and re-export without lose initial data -

i m using “spreadsheet”ruby gem generate xls files. i have xls file “myfile.xls” contains many sheets: sh_01, sh_02, sh_03 … want read name of last sheet (sh_last_number) , add new sheet called “sh_last_number+1” file (myfile.xls) , write data on it. in other words, have open (read data) , write on @ same time. if idea can’t realized spreadsheet, gem more efficient? in advance. you can spreadsheet gem. since working excel files, may need require excel component of gem if using older version: require 'spreadsheet' # may need require 'spreadsheet/excel' then working , writing pages simple. open workbook (xls file multiple pages) like: @workbook = spreadsheet.open("myfile.xls") and add sheet workbook you've opened, simply: new_sheet = "sh_#{@workbook.worksheets.size + 1}" @worksheet = @workbook.create_worksheet(:name => new_sheet) hope helps. cheers, sean

mysql - SQL Query: How to get items from one col paired with another but not visa versa -

i need query returns rows cola paired colb treat same values in opposite direction duplicates , removed. the best way explain query example: cola | colb ----------- abc | def def | abc asdf | 1234 1234 | asdf other| row 1234 | test sql magic cola | colb ----------- abc | def asdf | 1234 other| row 1234 | test it removes rows 'duplicate' in other direction. any appreciated. if prefer "clean" sql solution (without least() or greatest() ) job: select cola, colb your_table cola > colb or (colb, cola) not in (select cola, colb your_table) sql fiddle

how can I temporarily blank a Windows-7 2nd display monitor, in C#? -

i try setting width , height 0 using changedisplaysettingsex, blanks display monitor, when set w , h (and restore dmposition.x) stays off. my system has 2 monitors, , i'm trying temporarily blank 1 of them. later, need turn on. here's code................. public static void set_monitor_settings( int devnum, bool monitor_on_off ) { if( monitor_on_off ) console.writeline("turn on ultrasound monitor"); else console.writeline("turn off ultrasound monitor"); // init: display_device lpdisplaydevice = new display_device(0); // out display_device monitor_name = new display_device(0); // out devmode display_setting = new devmode(); lpdisplaydevice.cb = marshal.sizeof(lpdisplaydevice); display_setting.dmsize = (ushort)marshal.sizeof(display_setting); // set lpdisplaydevice select 2nd display device: enumdispl

mysql - Vague SQL error... what's going on here? -

i'm getting error mysql useless error message i've ever seen: error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near 'not null, primary key (userid, tweetid), foreign key (userid) references user(' @ line 4 great, check manual... > _ _> here's sql source; i'm sure exceedingly simple familiar sql, i'm newb. me looks fine. i'd have more well-formed question "what's error," error message vague, , me having little experience, i'm pretty lost. create table user ( username varchar(20) not null, userid integer not null, fullname varchar(100), passwordhash varchar(256) not null, email varchar(256) not null, imageurl varchar(200), facebookurl varchar(200), tagline varchar(140), membersince timestamp not null, primary key (userid) ); create table

php - Getting broken images from blob storage in Azure websites -

my php code seems correct, (the part talks blob storage). //talk blob storage, links, based on file name $storageclient = $this->azure->get_blob_storage(); foreach($result $photo) { $sharedaccessurl[] = $storageclient->generatesharedaccessurl( 'container', $photo['file'], 'b', 'r', $storageclient ->isodate(time()), $storageclient ->isodate(time() + 3000) ); } foreach($sharedaccessurl $item) { $pictures[] = $item; } this gets absolute url links, store inside array, pass view , retrieve images. this: <img src="<?php echo $pictures[$i]; ?>" height=100px width="100px"> (where pictures[$i] = http://azure blobstorage etc... on local machine, everytime refresh page, or flick through pages there images, load fine. however, when upload app onto azure

Is there a way to slowdown mysql query for lower cpu usage? -

i ordering int rows desc on table 300k rows , selecting @rownum:=@rownum+1 update same row's rank field. it works takes long time. can accept longer time, can let sleep give free space cpu make other jobs? like putting sleep(0.25 sec) in while(1>0) loop... update: set @rownum=0; update user u, (select @rownum:=@rownum+1 rank, id user u order score desc) bb set u.rank=bb.rank u.id=bb.id no. can have minor influence on priority insert delayed statement, adding low_priority update, or adding high_priority select. affects queueing table locks in storage engines using them. cannot have more granular control that. shouldn't way either, since dbms balance internally, , 1 slow query should never make query much slower. if 'other jobs' mean other tasks on same server, ionice or nice entire mysqld process. having answered actual question, query slow because misses index on field you're sorting by, such triggering filesort , temporary flags on

c# - mono in unity 3d and .net remoting -

i working on unity project need work remoting client. have created interface class , using remoting server in other unity project. while server working without problems, creation of client fails following exception: system.typeinitializationexception: exception thrown type initializer system.runtime.remoting.channels.socketcache ---> system.notimplementedexception: requested feature not implemented. @ system.threading.threadpool.unsaferegisterwaitforsingleobject (system.threading.waithandle waitobject, system.threading.waitortimercallback callback, system.object state, timespan timeout, boolean executeonlyonce) [0x00000] in :0 my code client: myremotableobject remoteobject; void awake () { try { tcpchannel chan = new tcpchannel(); channelservices.registerchannel(chan, false); remoteobject = (myremotableobject)activator.getobject(typeof(myremotableobject), "tcp://localhost:124/targetshootermenu"); } catch (excepti

java - Parse XML files with strange syntax -

this question has answer here: xml child node attribute value 3 answers first: there name type of xml syntax? second: how can parse xml file java, have looked on som sax examples, cant figure out how parse xml files type of syntax. please give me som advice. <company> <staff firstname="yong" lastname="mook" nickname="mkyoung" salary="10000" /> <staff firstname="low" lastname="yin fong" nickname="fong fong" salary="2000" /> </company> the dom4j library great if xml fits memory. usage: document doc = documenthelper.parsetext(xmlstring); note: use 1.6.1 version, 2.0 version not active , development stopped in alpha.

Ruby String Encode Consecutive Letter Frequency -

i want encode string in ruby such output should in pairs decode it. want encode in such way each pair contains next distinct letter in string, , number consecutive repeats. e.g if encode "aaabbcbbaaa" output should [["a", 3], ["b", 2], ["c", 1], ["b", 2], ["a", 3]] here code. def encode( s ) b = 0 e = s.length - 1 ret = [] while ( s <= e ) m = s.match( /(\w)\1*/ ) l = m[0][0] n = m[0].length ret << [l, n] end ret end "aaabbcbbaaa".scan(/((.)\2*)/).map{|s, c| [c, s.length]}

java - Can Hibernate be used to lock a database table or row so that other programs can't access it? -

i have batch program gets primary key value database table (table_a). batch program logic primary key value , adds new table (table_b). have java program uses hibernate grab primary key value table_a well. program logic primary key value tries add table_b. happens database table constraint exception (primary key exist) in table_b because batch program has inserted primary key value table_b. is there way java program put lock on table_a using hibernate when it's running? did research , saw hibernate have locking api wondering if locks database allowing other programs access it? all or subset of rows can locked via hibernate api. these row locks , not lock entire table (just rows). said in documentation , locking mechanism of database used: hibernate uses locking mechanism of database, , never lock objects in memory.

c# - How upload image to server with multipart form data -

i want emulate request this logs sniffer -----------------------------708299735697 content-disposition: form-data; name="_file" 1.jpg -----------------------------708299735697 content-disposition: form-data; name="file"; filename="blob" content-type: image/png ‰png ............ that code on csharp. var taimalda = datetime.now.ticks; var boundary = "------------------------" + taimalda ; var newline = environment.newline; var propformat = "--" + boundary + newline + "content-disposition: form-data; name=\"{0}\"" + newline + newline + "{1}" + newline; var fileheaderformat = "--" + boundary + newline + "content-disposition: form-data; name=\"{0}\"; filename=\"{1}\"" + newline + "content-type: image/png"; var req = (httpwebrequest)httpwebrequest.create("htt

jquery - Best way to keep textarea synced with server text file -

hi i'm making simple application users can type information text area , not have worry saving or losing it. i'm using jquery/javascript detect changes text area, using ajax send value php writing server. have basic "busy" lock prevent overlapping ajax. however, i'm finding unreliable. there better way this? var busy = false; function save () { if(busy === false) { busy = true; var content = $('#text').val(); var file = 'store.txt'; $.get("storecontent.php", { content_fromjq: content, file_fromjq: file}) .done(function(data) { busy = false; }); } } $('#text').bind('input propertychange', function() { save(); }); php: if (isset($_get['content_fromjq'])) { $content = $_get['content_fromjq']; $file = $_get['file_fromjq']; $html = new domdocument(); $html->loadhtmlfile($file); $html->getelementbyid('content')->nodevalue = $content; $html

AJAX not firing in JSF 2.0 -

i have problem ajax requests not firing in jsf, unknown reasons. admin.xhtml snippet: <h:form id="adminpanel"> ... <f:subview id="editcustomer#{customer.id}"> <p class="#{adminservice.geteditcustomerclass(customer.id)}"> <h:inputtext id="email#{customer.id}" value="#{adminservice.customeremail}"/><br/> <h:inputtext id="firstname#{customer.id}" value="#{adminservice.customerfirstname}"/> <h:inputtext id="lastname#{customer.id}" value="#{adminservice.customerlastname}"/><br/> <h:commandbutton id="saveedit#{customer.id}" type="button" value="save"> <f:ajax render="@form" event="click" listener="#{adminservice.savecustomer()}"/> </h:commandbutton> <h:commandbutton id="canceledit#{customer.id}"

objective c - Prevent multiple copies of a file on OS X -

i have file somewhere on hard drive , make sure accessed particular program , not backed time machine copied versions feature of os x 10.7 in other way copied system - unless user explicitly i.e. copying other directory. is possible programmatically in objective-c or c? as far know, using csbackupsetitemexcluded should enough - you'll need link against coreservices framework access this. takes care of time machine , versions. i'm not aware of other cases system automatically copy file unless explicitly done user.

android - Can't change a Custom DialogFragment layout dynamically -

so reading through google api guides came across how load custom layout within alert dialog box here. i wrote class extends dialogfragment class this: string product; string description; string company; public void getadinfo(string p, string d, string c) { product = p; description = d; company = c; } public dialog oncreatedialog(bundle savedinstancestate) { alertdialog.builder builder = new alertdialog.builder(getactivity()); layoutinflater inflater = getactivity().getlayoutinflater(); builder.setview(inflater.inflate(r.layout.ad_dialog, null)); textview pt = (textview) getview().findviewbyid(r.id.product); pt.settext(product); textview dt = (textview) getview().findviewbyid(r.id.description); dt.settext(description); textview ct = (textview)getview().findviewbyid(r.id.company); ct.settext(company); builder.setpositivebutton("ok", new dialoginterface.onclickl

windows 7 - I want to get last user of files in directory -

i have tried use wmic datafile information ton of files have. looks there no get attribute see last person accessed file , created it. there alias can use this? ultimately, want name, location of file, last date used, created it, , used last. i tried using in batch file found on here , works not requirements... @echo off set properties=name,lastmodified,lastaccessed :nextparam if "%1" == "" goto endparams set properties=%properties%, %1 shift goto nextparam :endparams set drive=%cd:~0,2% set folder=%cd:~2% wmic datafile (drive="%drive%" , path="%folder:\=\\%\\") %properties% > output.txt i apologize ahead of time programming knowledge basic.