Posts

Showing posts from March, 2012

multithreading - beginner needs help with design/planning report-functionality in C++ Application -

i'm somehow stuck implementing reporting functionailty in log-parser application. this did far: i'm writing application reads logfiles , searches strings multiple regular expressions can defined in user-configuration file. every called "stringpipe"-defintion parsed configuration main-process spawns worker thread search single regex. more definitons user creates, more worker threads spawned. main function reads bunch of logstrings , sends workers process strings , on. now want every single worker thread spawned report information number of matches has found, how long took, did strings , on. these information used export csv, write db , on. now i'm stuck @ point created class "report". class provides member functions called worker threads make report-class gather infos needed generating report. for workers (which boost::threads / functors) have create report-object can call reporting functions for. the problem in design, because when worker...

php - How can I add custom image sizes to wordpress but have them in the admin? -

i know how use add_image_size in php register new size can used in templates. makes images in size, when they're uploaded. the sizes added don't show in admin, though. so 2 questions... how can image sizes make show in 'upload image' thing when bloggers make new post? is there way list in admin bloggers can add new ones without having change php code? or doing wrong, not putting add_image_size call in right place/file? sizes supposed show in upload menu section? cole wordpress doesn't show custom image size options in media lightbox, can add them using attachment_fields_to_edit filter. below add options custom image sizes have defined. add_filter('attachment_fields_to_edit', 'my_attachment_fields_to_edit_filter', 100, 2); function my_attachment_fields_to_edit_filter($form_fields, $post) { if (!array_key_exists('image-size', $form_fields)) return $form_fields; global $_wp_additional_image_sizes; foreach($_w...

mvvm - Is there a way of have simple validation in the controls in Silverlight -

i'm coming delphi programing world, i'm starting learn silverlight, entity framework, ria services, mvvm , stuff. i want know if there kind of technic, controls, approach, pattern or else allows simple validations or verifications live in client when user typing. in delphi world controls (db-aware ones) have ability of doing that, know type of data showing, can configure max length, in general know information data floating point type not allow more 1 point in , on. i understand different , have validations in business classes, services, models, domain , depends using, , in database. any thoughts suggestion can this? excuse me english not main language. validation in silverlight tied closely binding, , commonly done in 1 of 2 major ways: client-side validation using dataannotation-generated validators in property setters server-side validation done when entity committed store client-side validators depend on exceptions thrown in setter when validatio...

c# - MessageSecurityException No signature message parts were specified for messages with the 'http://...' action -

here config file used both client , server <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.servicemodel> <bindings> <wshttpbinding> <binding name="wshttpbinding_ipm_service" closetimeout="00:01:00" opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00" bypassproxyonlocal="false" transactionflow="false" hostnamecomparisonmode="strongwildcard" maxbufferpoolsize="524288" maxreceivedmessagesize="65536" messageencoding="text" textencoding="utf-8" usedefaultwebproxy="true" allowcookies="false"> <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384" maxbytesperread="4096" maxnametablecharcoun...

java - Sending file with custom attributes over a network -

i want create client-server program allows client send file server along information file (sender name, description, etc.). the file potentially quite large either text, picture, audio or video file, , because of not want have read whole file byte array before sending, rather read file in blocks, sending them on network , allowing server append blocks file @ it's end. however faced problem of how best send file along few bits of information file itself. @ minimum send sender's name , description both of input client program user, may change in future should flexible. what way of doing allow me "stream" file being sent rather reading in whole , sending? sockets natively streams of bytes shouldn't have problem there. suggest have protocol looks this. this allow send arbitrary properties long total length less 64 kb. followed file can 63-bit length , sent block @ time. (with buffer of 8 kb) the socket can used send more files if wish. dataou...

ruby on rails 3 - Can't use the nested_form_for gem -

i using nested_form_for gem first time. don't know if issue or if using wrong, getting "undefined method nested_form_for" error. have pretty regular form can see: <%= nested_form_for @user |f| %> <%= f.fields_for :godfathers |godfather_form| %> <%= godfather_form.label :name %> <br/> <%= godfather_form.text_field :name %> <br/> <%= godfather_form.label :description %> <br/> <%= godfather_form.text_field :description %> <br/> <%= godfather_form.link_to_remove "remove godfather" %> <% end %> <%= f.link_to_add "add godfather", :godfathers %> <% end %> by way, installed gem , ran the: rails generate nested_form:install command generate nested_form.js file included in layout after jquery inclusion( <%= javascript_include_tag :default, 'nested_form' %> ). any...

Rails 3 rateable model - How to create ajax rating? -

how create simple ajax rating there on page http://watir.com/documentation/ ? every visitor should able rate, dont need set permissions. want store ratings in column. user can sort ratings. please make detailled example. not javascript expert. i have found example create ratings scratch. authorizes user. can show me guidance create ratings without rater (user)? should not store values count votes. http://eighty-b.tumblr.com/post/1569674815/creating-an-ajaxified-star-rating-system-in-rails-3 what did add simple rating mechanism existing project following: i added 2 fields existing table (which contained items rated). were: rating_score => current score ratings => number of ratings led score for example, if 5 users would've voted "5" current item, rating_score 25, , ratings 5. current rating computed rating_score / ratings . then added new method controller of items rated, called "rate", looked like: def rate @item = item.fi...

c++ - How can I write data from txt file to database? -

if have txt number of rows , column (number of columns unknown @ beginning, columns separated tab), how can export data database? have managed iterate through first row count number of columns , create table accordingly need go through each row , insert data respective column. how can that? example of txt file: name size population gdp aa 2344 1234 12 bb 2121 3232 15 ... ... .. .. .. .. .. .. the table has been created: create table random id int, name char(20), size int, population int, gdp int the difficult part reading in text fields. according definition, field titles separated spaces. true text fields? a generic process is: create sql create statement header text. execute sql statement. while reading line of text doesn't fail parse text variables. create sql insert statement using field names , values variables. execute sql statement. end-while another solution convert txt file tab or comma separated fields. check database documenta...

.net - Facebook-C#-SDK wont stop "logging in" -

i trying build facebook webapp in vb.net using facebook c# sdk. sdk can used vb.net, know. trying app login on page load. can login, app not recognize logged in , continues loop through login again until stop it. here code. protected sub page_load(byval sender object, byval e system.eventargs) handles me.load dim faceauth new facebookclient dim fbsession new facebooksession if faceauth.accesstoken.length = 0 dim appid string = configurationmanager.appsettings("facebookappid") dim extendedpermissions string() = {"publish_stream", "offline_access", "read_stream", "manage_pages"} dim oauth = new facebookoauthclient() { _ .clientid = appid _ } fbsession.expires = now.adddays(1) dim parameters = new dictionary(of string, object)() { _ {"response_type", "code_and_token"}, _ {"display", "popup"}, _ {...

asp.net - Error:"Unable to find the requested .Net Framework Data Provider. It may not be installed." -

i having error said "unable find requested .net framework data provider. may not installed." i'm using (visual studio 2010) (sqlserver 2008 r2) , (.net framework 4.0) (asp.net:c#) i'm trying use subsonic vb.net windows apps , mysql , had same error you, i've installed vb.net 2010 express i read stack overflow question here suggested db connector had been installed before .net v4 (vs2010) hence couldn't found, thought sounded feasible downloaded latest mysql connector, uninstalled old 1 , installed new one. next time ran project simplerepository worked straight away! i blaming subsonic! great! hope might help

changing spring security logout-success-url programmatically -

i need redirect user 2 different logout urls based on role. how go doing this? i using spring security 2.0 , xml looks this: <s:http access-denied-page="/" > <s:intercept-url pattern="/pages/splashpage.jsf" access="is_authenticated_anonymously"/> <s:intercept-url pattern="/pages/home.jsf" access="role_user,role_merchant"/> <s:anonymous/> <s:form-login login-page="/" login-processing-url="/j_spring_security_check" default-target-url="/pages/home.jsf" authentication-failure-url="/" always-use-default-target='false' /> <s:logout invalidate-session="true" logout-url="/pages/logout.jsf" logout-success-url="/" /> <s:concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="false"/...

javascript - Addition and subtraction within bounds -

how write following in javascript: row-=21; if (row < 1) { row = 1; } you can this: row = math.max( row-21, 1); edit: if want able set minimum and/or maximum range, prototype own function number. number.prototype.adjust = function( adj, min, max ) { if( isnan( min ) ) min = -infinity; if( isnan( max ) ) max = infinity; var res = + ~~adj; return res < min ? min : res > max ? max : res; }; then can use this: row = row.adjust( -21, 1, 50 ); /* adjustment, min, max */ 1st argument adjustment 2nd argument minimum range (pass null no min) 3rd argument maximum range (pass null or leave blank no max)

oop - Delphi - Proxy Design Pattern - interface problem -

hi trying design patterns in delphi and, since couldn't find reference material in delphi, converting patterns have in o’reilly c# 3.0 design patterns book. not problem. have created proxy pattern book there concepts of delphi interfaces, constructors , destructor , general object lifetime , behavior apparently don't understand. first post code: unit unit2; interface uses sysutils; type isubject = interface ['{78e26a3c-a657-4327-93cb-f3eb175af85a}'] function request(): string; end; tsubject = class public function request(): string; constructor create(); end; tproxy = class (tinterfacedobject, isubject) private fsubject: tsubject; public function request(): string; destructor destroy(); override; end; tprotectionproxy = class (tinterfacedobject, isubject) private fsubject: tsubject; fpassword: string; public constructor create(); destructor destroy(); override; function authenticate(sup...

objective c - Function returning an array in ObjC for iPhone -

hello trying make function return array! going wrong here? -(char[10])print01:(int)int11{ //error: declared method returning array char arrayt[10]; for(int i=0;i<8;i++) { if ((int1-n1)>=0){ arrayt[i]='1'; int1-=n1; } else arrayt[i]= '0'; n1=n1/2; } return arrayt[]; // incompatible types in return } and want call that: char array1[10] = [self print01:(int)int1]; //error: invalid initializer any suggestions please? the best approach using nsarray (of objects of course, i'm assuming above code simplified sample, can use nsnumber). alternatively, return pointer array, common in c c (and objective c extension) cannot return array. unfortunately, require allocating memory array , using manual memory management, (malloc/free) depending on lifecycle of array, can anywhere nuisance awful. recommendation taking char *dest parameter, , inserting chars array d...

Efficient Rolling Window Identification in Matlab -

i have time-series data missing data running estimation function on rolling windows. windows not uniform length , each variable has differing start , end dates. want remove windows have missing data. windows overlap, single missing observation remove great many windows consideration. want mapping each date windows contain it. currently, have logical matrix has row every possible day , each column represents 1 of windows true values days of window. can subset matrix rows representing missing data, , whichever columns contain true values invalid windows. problem logical matrix gets large (10k x 10k ~100mb) , there can many. can convert sparse solves size problem, calculation of windows remove becomes slow when windows long. this doesn't smell problem should resource intensive (either memory or computation), there better way? edit: let me add example may little clearer. full set of dates range 1 100. windows 1:10, 2:11, 3:12 , on through 91:100 (these uniform, doesn't ma...

Iphone SDK: Image arrays? -

i'm making "tapping-app" have kill zombies tapping on them. can't make progress because can't use methods need properly. my app works that: i have timer spawns image 3 times per second: [nstimer scheduledtimerwithtimeinterval:1.0/3 target:self selector:@selector(spawn) userinfo:nil repeats:yes]; then have spawn command: - (void) spawn { cgrect myimagerect = cgrectmake(0.0f, 0.0f, 320.0f, 109.0f); uiimageview *myimage = [[uiimageview alloc] initwithframe:myimagerect]; [myimage setimage:[uiimage imagenamed:@"myimage.png"]]; myimage.opaque = yes; [self.view addsubview:myimage]; [myimage release] } i have "touchesbegan" command: - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [[event alltouches] anyobject]; cgpoint touchlocation = [to...

Include php code within echo from a random text -

i want display php code @ random , have <?php // load file contain thecode $adfile = "code.txt"; $ads = array(); // 1 line per code $fh = fopen($adfile, "r"); while(!feof($fh)) { $line = fgets($fh, 10240); $line = trim($line); if($line != "") { $ads[] = $line; } } // randomly pick code $num = count($ads); $idx = rand(0, $num-1); echo $ads[$idx]; ?> the code.txt has lines like <?php print insert_proplayer( array( "width" => "600", "height" => "400" ), "http://www.youtube.com/watch?v=xnpcpcvepcg"); ?> proplayer wordpress plugin displays video. codes in code.txt work well, not when use pick line code.txt. instead of full php line get: "width" => "600", "height" => "400" ), "http://www.youtube.com/watch?v=xnpcpcvepcg"); ?> how can make echo show php code, rather txt version of php code? try usi...

design - Strategies and tools for planning programs? -

i second year compsci university student, , programs getting larger, , time have them shorter, find marks dropping. i believe isn't because not putting in enough time or effort, instead because have little experience creating bigger programs. first year compsci had programs trivial me (particularly first semester), , in second, programs had 1 component , maybe 1 or 2 tricky parts figure out. an example of assignment given now, includes making vcard reader, given standard, takes .vcf vcard file , parses structure. 'hard' parts assignment many, given structure , function definitions had work with. notably, had handle lines continued onto next ('folded' lines), parse given line , spot errors , return given code, , manage multiple pointers in proper fashion ensure complete before filling in structure. now have learned particular tool, function diagrams, list functions , link them based on calling function, , have found has helped me recent assignment, not ne...

JavaScript Multiplication Game -

i supposed make simple program. produces multiplication problem, , when user types correct answer, supposed produce question. instead goes infinite loop , never stops, answer field , button go away. also, supposed make comment users answer, 1 of 4 different sayings. without using arrays how that? my professor no help, getting aggravated have no else turn. <html> <title>hw 9.27 , 9.28</title> <head> <script type="text/javascript"> var number1; var number2; var answer3; var answer2; function problem() { number1 = math.floor(1 + math.random() * 9); number2 = math.floor(1 + math.random() * 9); document.writeln("how " + number1 + " times " + number2 + " ?"); answer2 = (number1 * number2); } function answer1() { var statusdiv = document...

c# - How do I move row from one DataGridView to another DataGridView? -

i have 2 datagridviews have same column schema (although 2 different dataviews datasource - if matters). best/quickest way move row 1 datagridview other? i believe if have row in datatable table1 , want add datatable table2 this: table2.rows.add(row.itemarray); then have remove row this: table1.rows.delete(row); this pseudo code should work, did in past. of course works if both tables have same schema, mentioned.

Deploying C# program with MYSQL database usage -

hi given assignment database teacher , had make ui , interface mysql . i did installing mysql connector. problem donot know has on computer or not.i sure has installed mysql ,sqlyog , sql workbench on system no visual studio. if give him visual studio solution not going work planned make setup project there confusion work @ system? any idea how sorted? instead of referencing mysql connector gac, create folder called references in source code folder, copy connector there, remove refence gac , re-add reference local folder, build, test... then close visual studio , zip folder source code , reference subfolder , send him email.

html - Using :before pseudo-element on '<a href' that is wrapping a <button> element - can it be done? -

Image
i interested in seeing if can use :before pseudo-element on <a href wrapped around <button> element? currently, firefox shows thin blue line behind <button> element - due being wrapped in <a href . if use inline style within <a href line goes away: <a href="#" style="text-decoration:none;"><button> however, since have <button> elements on multiple pages, want target them using css if possible (and don't particularly want go , add class <a href wrapping <button> 's on site). thinking :before pseudo-element come in handy doesn't seem work: a:before button{ text-decoration:none !important; } this how <button> 's display in firefox, see blue default text-decoration applied <a href . reason showing on right hand side because class of margin-left:5px applied <button> element: here's basic version of buttons on jsfiddle (ignore slight appearance difference...

Using Facebook API. Retrieve 0 events through Android -

i'm using facebook api retrieve /me/events returns blank json array. when make same call in browser using different access token, events return....what going on?? lacked permission user_events....

php - Complex MySQL join from old table to new -

i have old database named locations table inside named locations. this table has 7 variables: id (int, index), approved(int), city(text), country(text), heading(double), lat(double), lng(double). i have new database named complexity. database has new table named gsvraw i need copy old table new table, gets tricky: the new database going use spatial indexing of mysql can search within polygon later. in new database, instead of lat, lng, want add new column that's called location. the example statement creating new column: alter table gsvraw add location point not null; create spatial index location on gsvraw (location); this example statement inserting new value location column: insert gsvraw (location) values( geomfromtext( 'point(40 -100)' )); 40 , -100 lat , lng. any ideas? i wasted hour each of 3 different "guru's" here @ mit , literally got nowhere. the server i'm running causing major problems using python , mysqldb out. ...

python - PyTables batch get and update -

i have daily stock data hdf5 file created using pytables. group of rows, process array , write disk (update rows) using pytables. couldn't figure out way cleanly. please let me know best way accomplish this? my data: symbol, date, price, var1, var2 abcd, 1, 2.5, 12, 12.5 abcd, 2, 2.6, 11, 10.2 abcd, 3, 2.45, 11, 10.3 defg, 1,12.34, 19.1, 18.1 defg, 2, 11.90, 19.5, 18.2 defg, 3, 11.75, 21, 20.9 defg, 4, 11.74, 22.2, 21.4 i read rows correspond each symbol array, processing , update fields var1 , var2. know symbols in advance can loop through them. tried this: rows_array = [row.fetch_all_fields() row in table.where('symbol == "abcd"')] i pass rows_array function compute values var1 , var2 , update each record. please note var1, var2 moving averages not able calculate them inside iterator , hence need entire set of rows array. after calculate whatever need using rows_array, not sure how write data i.e., update rows new calculated values. when updatin...

c - Printing the return address using format string -

i required print out return address stored in stack function? format supposed follow print is void function() { int *retptr = 0; printf("return address 0x%08x\n", (unsigned int *)(&retptr+return_addr_offset)); /*code goes here*/ } can please help! not supposed using inbuilt function. how can this? this smells homework me if can't use built-in functions. in case, there's nothing magic being pointer; need print out hex number. without knowing functions if allowed use, it's kind of hard help. need work out 8 hex digits output them.

c - Is it legal to create a flexible array member of size zero? -

the c99 standard allows creation of flexible array members such as typedef struct pstring { size_t length; char string[]; } pstring; this initialized pstring* s = malloc(sizeof(pstring) + len) . permissible len zero? seem consistent, , nice saving space time time (probably not pstring example, of course). on other hand, have no idea following code do: pstring* s = malloc(sizeof(pstring)); s->string; this seems sort of thing might work 1 compiler , not another, or on 1 os , not another, or on 1 day , not another, want know standard says this. malloc in example code undefined behavior, or access s->string invalid, or else entirely? what valid, accessing s->string[0] or feeding s->string function accessing data invalid. the c99 standard says (§6.7.2.1): struct s { int n; double d[]; }; ... struct s t1 = { 0 }; // valid ... the assignment t1.d[0] undefined behavior, possible that sizeof (struct s)...

c++ - Intercept incoming SMS -

i'm developing app symbian device need silent filter incoming sms, , following link code that: http://symbian.devtricks.mobi/tricks/silent_receiving_of_sms_messages/ another similar code on nokia http://wiki.forum.nokia.com/index.php/sms_utilities_api it work, problem after reboot phone sms has been intercept still add inbox. know on site did mention use kioctlreadmessagesucceeded prevent that, did; problem still there. tried both code still same result. there i'm missing? another problem code no longer work after call came in, sms won't intercept anymore after that. way fix that? thanks, appreciated. we regards not intercepting sms after reboot, re-starting executable (and hence listener) after reboot? can nokia startup list management api . with regards failing after call has come in, sounds executable may panicing (and stopping listening). have checked see if panicing , whether still running after call has come in? i've done kind of applica...

matlab - How to write a function that accepts a cell array of strings and builds a vector of numbers of the same lenght -

i'm trying write function accepts cell array of strings , builds vector of numbers of same length. each item in output vector length of strings in each cell array. if please me or show me written example of appreciate much. i'm new matlab , have been working on getting work long time , cant on own. thank you. a more succinct version of zellus's answer: s = {'one', 'two', 'three'}; numbers = cellfun(@length, s)

design - User-defined conversions to or from a base class and entity-framework -

using entity framework (ef) orm tool in 3-tier project, found entity framework generated code dal + little bll . since dal , bll different layers in scenario , different coders work on each of them, there need separating each layer different project. the problem don't want changing ef generated code , still need project bll (i'm aware of ef partial classes , on...changing() methods doesn't make sense of separation of concepts me , partial class cannot implemented in different project). i wish ef generate interface each entity , implement generated code. way, implement interfaces bll classes. making changes entities in ef designer lead automatically changing interfaces , bll stopped working (doesn't compile more, since interface has been changed). unfortunately ef doesn't supply interfaces , extracting them generated code hard maintain since new change model need extracting them manually again. then thought of wrapping entity framework generate...

c++ - Why is the wrong function being executed? -

i ran confusing situation today i'm hoping can explain me. i have c++ program 4 classes: a base class acts common interface, an enroll class, subclasses base , has pure virtual enroll() method, a verify class, subclasses base , has pure virtual verify() method, a both class subclasses both enroll , verify , provides implementations enroll() , verify() like so: class base { public: base () { } virtual ~base () { } }; class enroll : public virtual base { public: virtual ~enroll () { } virtual void enroll () = 0; }; class verify : public virtual base { public: virtual ~verify () { } virtual void verify () = 0; }; class both : public enroll, public verify { public: virtual ~both () { } virtual void enroll () { printf ("enrolling.\n"); } virtual void verify () { printf ("verifying.\n"); } }; instances of both instantiated in non-member function, c...

cannot understand the following code in android -

ss.setspan(new urlspan("tel:1234556"), 13, 17, spanned.span_exclusive_exclusive); tv.settext(ss); tv.setmovementmethod(linkmovementmethod.getinstance()); what linkmovementmethod do? urlspan class , use of it? string tel:123456 mean? tel keyword? need answer asap thank in advance. linkmovementmethod controls how text view scrolls through content. manages focus transfer between links. urlspan creates dynamic link (like <a> tag in html); in case telephone number. see docs on android intents list .

oop - What are the differences between Aspect-oriented programming and object-oriented programming -

the question self-explanatory. differences between these two? i think answered here

How can i play/embed facebook videos in my web application -

i've got 1 application i'm getting facebook videos in below mentioned format, here i'm not able player me play kind of videos. [link] => http://www.facebook.com/video/video.php?v=195111727174972&comments [source] => http://video.ak.fbcdn.net/cfs-ak-snc6/79608/202/195111727174972_16044.mp4?oh=32f4a271d5ae7e3259ae9 thanks to embed facebook video, use html fragment. <object width="####" height="####" > <param name="allowfullscreen" value="true" /> <param name="allowscriptaccess" value="always" /> <param name="movie" value="http://www.facebook.com/v/xxx" /> <embed src="http://www.facebook.com/v/####" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="####" height="####"> </embed> </object> replace "####" vi...

can i increase the relative layout size when in zoom mode in android -

possible duplicate: dynamically increase relative layout size in android can increase relative layout size when in zoom mode in android well dont need worry that... being relative layout, fits automatically

How to find the length of a token in antlr? -

i trying create grammar accepts character or number or anything, provided length equal 1. is there function check length? edit let me make question more clear example. wrote following code: grammar first; tokens { set = 'set'; val = 'val'; und = 'und'; con = 'con'; on = 'on'; off = 'off'; } @parser::members { private boolean inbounds(token t, int min, int max) { int n = integer.parseint(t.gettext()); return n >= min && n <= max; } } parse : set expr; expr : val('u'('e')?)? string | und('e'('r'('l'('i'('n'('e')?)?)?)?)?)? (on | off) | con('n'('e'('c'('t')?)?)?)? onechar ; char : 'a'..'z'; digit : '0'..'9'; string : (char | digit)+; dot : .; onechar : dot { $dot.text.length() == 1;} ; sp...

ios - Three20 TTPhotoViewController is not displaying photos -

i have gone through few tutorials including sample app included three20 , cannot figure out why photos aren't showing in ttphotoviewcontroller. find pretty hard debug. below code have. thoughts on why images not load , how debug great. black view in between bottom tabbar , upper nav bar. see left , right arrows overlayed on black view seems navigating photos although thought supposed display thumbnail gallery. // ttphoto class // photo.h #import <foundation/foundation.h> #import <three20/three20.h> @interface photo : nsobject <ttphoto> { nsstring *_caption; nsstring *_urllarge; nsstring *_urlsmall; nsstring *_urlthumb; id <ttphotosource> _photosource; cgsize _size; nsinteger _index; } @property (nonatomic, copy) nsstring *caption; @property (nonatomic, copy) nsstring *urllarge; @property (nonatomic, copy) nsstring *urlsmall; @property (nonatomic, copy) nsstring *urlthumb; @property (nonatomic, ...

visual studio 2008 - Paste Special in C# vsto Excel -

i working on c# vsto excel application. whenever user pastes in excel template excel sheet,it pastes cell format along cell data in excel template. want avoid this. googled & came across term paste special. paste special paste contents , no alter format of current sheet. i want introduce paste special option in vsto application. i have code here, application.onkey("^v", "pastespecv"); but not working... can 1 me ? download dll http://globalmousekeyhook.codeplex.com/ add reference mousekeyboardactivitymonitor.dll private keyboardhooklistener k_keylistener; private void thisworkbook_startup(object sender, system.eventargs e) { k_keylistener = new keyboardhooklistener(new apphooker()); k_keylistener.enabled = true; k_keylistener.keydown += new keyeventhandler(k_keylistener_keydown); } void k_keylistener_keydown(object sender, keyeventargs e) { if (control.modifierkeys == ke...

asp.net mvc - JQuery - Drag & Drop - Id draggable element -

i'm new in forum i learned jquery 2 week , i'm inexperienced. site build asp.net mvc , use jquery 1.4.1 this code html ... <% foreach (var item in model.amici) {%> <div id="amico_<%= item.id %>" idamico="<%= item.id %>"> <%= item.name %> </div> <% } %> .... script $(function() { $("div[id^='amico_']").draggable({ revert: "valid" }); $("#droppable").droppable({ activeclass: "ui-state-hover", hoverclass: "ui-state-active", drop: function(event, ui) { var index = $(".ui-draggable").attr('idamico'); $(this) .addclass("ui-state-highlight") .find("p") .html("id = " + index); } }); }); the problem id at...

asp.net - How to create rotating tag cloud in jQuery -

i cannot explain functionality actually. want rotate links in spheric form. visit http://www.chemicalformula.org/ . on site, see region "chemical formulas" in middle-left of page, links rotating in spheric, circular form. want functionality using jquery / jquery in asp.net application. can achieve ? for pseudo 3d need rotation matrix calculations. http://en.wikipedia.org/wiki/rotation_matrix i can't answer question whether or not you can achieve . . but believe code available in many forms. http://plugins.jquery.com/project/tag-sphere http://plugins.jquery.com/plugin-tags/cloud http://www.devirtuoso.com/2009/08/how-to-create-a-3d-tag-cloud-in-jquery/ and many more . .

objective c - Adding Disclosure button and NSTextView to NSAlert -

i want display nsalert accessory view. accessory view needs have: 1) nstexview displaying mandatory contents 2) disclosure button nstextview the disclosure button required hide , show second nstextview. however, @ same time want nsalert dialog resize accomodate , fit contents. save dialog in cocoa has disclosure button , want same functionality nsalert. suggestions? here go: 1) nsalert has window property. hence use that. 2) create custom accessory view containing 2 nstextview's , disclosure triangle 3) set custom view accessory view of nsalert 4) before displaying alert, set window property of nsalert in custom view (this way have access nsalert's window when click disclosure triangle) 5) add target disclosure button event , save state (expanded/collapsed) 6) in event disclosure triangle click: use nsalert's saved window frame adjust height, size , width of nsalert. 7) important here note - when adjust height, nsalert grows top hence requir...

c++ - What's a good algorithm for Defense of a Kingdom? -

Image
i trying solve defense of kingdom problem , came algorithm exceeds time limit of problem. i want know algorithm solve within time limit. the problem: theodore implements new strategy game “defense of kingdom”. on each level player defends kingdom represented rectangular grid of cells. player builds crossbow towers in cells of grid. tower defends cells in same row , same column. no 2 towers share row or column. the penalty of position number of cells in largest undefended rectangle. example, position shown on picture has penalty 12. help theodore write program calculates penalty of given position. input the first line of input file contains number of test cases. each test case consists of line 3 integer numbers: w — width of grid, h — height of grid , n — number of crossbow towers (1 ≤ w, h ≤ 40 000; 0 ≤ n ≤ min(w, h)). each of following n lines contains 2 integer numbers xi , yi — coordinates of cell occupied tow...

c# - Why doesn't my AppDomain.CurrentDomain.UnhandledException event always fire? -

i have windows service program running in release mode runs 24/7 makes in-process com calls c++ library , crashes log4net log call in appdomain.currentdomain.unhandledexception event doesn’t fire. instead process terminates , eventlog log message written … what’s strange again code doesn’t have eventlog.writeentry calls. can me figure out why appdomain.currentdomain.unhandledexception not firing in cases? thanks in advance event log message: eventtype clr20r3, p1 programname.exe, p2 0.0.0.0, p3 4d5bd49f, p4 mscorlib, p5 2.0.0.0, p6 4a7cd8f7, p7 41b3, p8 a3, p9 system.argumentoutofrange, p10 nil. the entry in event log written windows, , telling throwing argumentoutofrangeexception . without seeing code contained in event handler appdomain.currentdomain.unhandledexception , it's difficult why , it's 1 of following occuring: your exception handler throwing argumentoutofrangeexception you have multiple appdomain's in process , it's 1 of othe...

php - Generating ASP POST secure variables -

i want parse search result of 1 site builded on asp using php curl. no problems dom there problem post variables. , don't know how generate in php script. asp generates 6 variables __ prefix. __eventtarget __eventargument (has value base 64 encoded) __lastfocus __viewstate (has value) __viewstateencrypted __eventvalidation (has value base 64 encoded) and tried copy post data browser of httpfox , data script works half of hour: ... define('postvars', '__eventtarget=&__eventargument=&__lastfocus=&__viewstate=1wi2mmtcr4dm7pou... ... url_setopt($ch, curlopt_postfields ,postvars); ... how generate __eventargument, __viewstate , __eventvalidation? ps. parsing site http://nakolesah.ru/ . parse result of form. id of form submit button "ctl00_contentplaceholder_btnsearchwheels". result page is: http://nakolesah.ru/wheels/podbor/porazmeru.aspx . you cannot generate values. generated asp.net, encrypted server machine keys , have va...

html - jQuery and Form Object Array -

this form input objects same names , unknown number of clones/duplicates such one: <input name="field[]" id="field[]" value=""> using jquery, dynamically add copies of object theoretically makes this: <input name="field[]" id="field[]" value=""> <input name="field[]" id="field[]" value=""> <input name="field[]" id="field[]" value=""> <input name="field[]" id="field[]" value=""> ... , 1 , forth. question: show me reference such objects, example, on-change procedure. thanks in advanced. it not valid have multiple elements same id. you can n-th input using: $('input').eq(n)

javascript - Debug popup.html of a Chrome Extension? -

i'm making chrome extension , need view html/css/js of popup.html . i can't right click inspect elements. there way? need make sure css , javascript being inserted correctly. how debug problem in popup file? right click extension's button, 'inspect popup'