Posts

Showing posts from July, 2011

android - different getPath for different images -

i need set different getpath() different images . below sample describing getpath 1 image . not able understand how use setting 2 images . public string getpath(uri uri) { string[] projection = { mediastore.images.media.data }; cursor cursor = managedquery(uri, projection, null, null, null); if (cursor != null) { // here nullpointer if cursor null // can be, if used oi file manager picking media int column_index = cursor .getcolumnindexorthrow(mediastore.images.media.data); cursor.movetofirst(); return cursor.getstring(column_index); } else return null; } bitmap :- public void decodefile(string filepath) { // decode image size bitmapfactory.options o = new bitmapfactory.options(); o.injustdecodebounds = true; bitmapfactory.decodefile(filepath, o); // new size want scale final int required_size = 70; ...

c - What is unhandled excpetion error mean? -

i writing in visual studio,a c programm , error: unhandled exception @ 0x77dd3e14 in scicomput.exe: 0xc0000005: access violation reading location 0xff630018. can explain quite absolute beginner mean? it means trying access segment of memory doesn't "belong" program, i.e. memory haven't allocated, reserved. usually, causes such errors attempting write read-only memory or dereferencing null-pointers . "unhandled exception" means haven't provided way program handle errors when occur, crashes. note : can handle exceptions via try...catch mechanism in c++. http://msdn.microsoft.com/en-us/library/6dekhbbc.aspx c, however, doesn't support this.

python - Creating a Function to sum the results of an equation. Please look, Not so simple? -

i'm new programming , started using website. can't find similar simple problem. i'm using phyton 3.3. i'm creating code measures solar intensity on solar panels. did initially, decided make equations more complex better reflect real world situations. i'm putting simplified equation similar problem encountered: total=0 def equation(): x=2+i total+=x print (total) in range(1,32): #represents no of days in january (31 days) equation() in range (32,61): #represents no.of days in february (28days) equation() etc....for months this problem("total+=x). cannot add results x. error says "total" referenced before assignment. reference within function give me results (x) each iteration, not sum of iterations. the real equation contains more 15 lines of formulas. want insert equation onto different ranges (all 12 months of year). don't want copy , paste huge formula under each range. messy. prefer more efficient ...

javascript - Refresh DIV by command from server -

i want have page uses mysql database information, let's 0 or 1 i want page auto refresh div value 0 or 1 database @ specific interval. but viewing page same information @ same time. server in charge of interval. how this? there several possibilities: 1) websockets latest of technologies. if want near realtime update of page , have infrastructure providing possibilities, way go 2) comet or long polling second alternative 3) primitive - working - startingpoint poll server. stackoverflow article

java - Modifying data from an Async task in an entirely different class -

i know out of curiosity if there convenient ways of pulling data out of async task created inside class, , modifying data in class (without extending classes) i have way it, involves making methods static along async task itself for example, here i'm making string "text" in async task public class main extends activity{ //context ctx; static class myasynctask extends asynctask<void,string,string>{ static string result; private static context context; public myasynctask(context m) { this.context = m; } @override protected string doinbackground(void... noargs) { result = "text"; return result; } protected void onpostexecute(string result) { super.onpostexecute(result); } public static string getstr() { return result; } }; @override protected vo...

oop - Factory design pattern location of switch statements -

i trying wrap head around usefulness of factory design pattern. like many implementations of design pattern (ie http://msdn.microsoft.com/en-us/library/ee817667.aspx ) there switch statement in main() probes string decide concretecomputerfactory create (which later sent computerassembler.assemble(computerfactory factory) method). the way see problem: 1. user of factory (main()) "knows" concrete factory implementations definition of design pattern supposed hidden from. 2. whenever new concretecomputerfactory introduced, abstraction doesn't hold grounds! have go client (main()) add if/case statement. proposition: move if/switch statement/s computerassembler. (this has slight problem computerassembler has 2 reasons change: a. overall stuff related creation b. adding new concretecomputerfactory. but: better in client (main)) i assume don't grasp idea yet. hear why problems specified incorrect, , why proposition isn't better idea thanks :) the b...

sqlite - go programming: sqlite_master returns EOF using sqlite3 package -

i trying check if table exists after table creation "select name sqlite_master type='table' , name='testtable';" returns nothing ( eof ). doing wrong? sqlite3 package taken http://code.google.com/p/go-sqlite/source/browse/#hg%2fgo1%2fsqlite3 go version: 1.2.1 got: hello, world fileexists(dbname) returned: false database ok creating testtable... success! inserting something... checking testtable... failed scan variable, error: eof expected: hello, world fileexists(dbname) returned: false database ok creating testtable... success! inserting something... checking testtable... table detected code: package main import "os" import "fmt" import "time" import "code.google.com/p/go-sqlite/go1/sqlite3" func main() { dbname := "sqlite.db" defer time.sleep(5000 * time.millisecond) fmt.printf("hello, world\n") os.remove(dbname) fe := fileexists(dbname) fmt.printf("fileexists(dbname) return...

Cocos2d V3 issue with texture parameters -

i've been following tutorial creating textures using cocos2d v2 using v3 (i have started learning). ran few issues v2 code doesn't work in v3 managed round them. i'm stuck 1 issue: cctexparams tp = {gl_linear, gl_linear, gl_repeat, gl_repeat}; error: use of undeclared identifier 'cctexparams' another comment suggested: texture2d::texparams tp = {gl_linear, gl_linear, gl_repeat, gl_repeat}; but doesn't work either (or i'm doing wrong). can show me need do?

encryption - Java Cipher Program -

firstly, here instructions program put together... provide main method. should:  input string , shift value  convert upper case  perform following items on alphabetic characters between , z  utilize loop uses postfix incrementing operator o convert character ascii equivalent (type cast) o shift b y shift value entered above  if reach end of alphabe t, wrap around  example: shifted left 2 become y o convert character equivalent (type cast) o output new character  input string , shift value  perform same steps above convert encrypted text plain text  sure input again different encrypted text may entered  main method can call separate method perform encryption/decryption not required. utilize postfix increment/decrement operations , compound assignment operators math. e xample: x++ or x+=2. the code have far is: /* jursekgregchapter12t.java greg jursek program encrypt entered text user input shift value , decrypt text in same manner. */ import java.lang.*; import j...

file upload - "MIMEParsingException: Missing start boundary" exception happening only in Chrome Browser, Firefox works fine during Jersey fileUpload -

fyi, have following jersey jars in app's classpath along mimepull jar version as: jersey-apache-client-1.11.jar jersey-apache-client4-1.11.jar jersey-client-1.17.1.jar jersey-core-1.17.1.jar jersey-guice-1.17.1.jar jersey-json-1.17.1.jar jersey-multipart-1.17.1.jar jersey-server-1.17.1.jar jersey-servlet-1.11.jar mimepull-1.6.jar i tried of them either 1.11 or 1.17.1 jersey specific jars. when tried submit file upload request via latest chrome browser (here client side html code submit file upload): <form name="uploadfile" action="/app/fileupload" method="post" enctype="multipart/form-data"> <input type="file" name="file" class="input-file"/><br/> <button type="submit" id="upload-btn" class="btn btn-primary">upload</button> </form> strangely enough, file upload jersey resource not hit , 400 error in chrome browser following exception in...

c++ - Painfully slow maze making program -

i writing program generates size maze want. first creating every cell in maze , assuming entirely walled in. each declared own set. random cell selected , random direction break down wall. random direction funcion makes sure valid direction cell. program makes sure 2 cells looking join arent connected somehow , if arent breaks wall. if connected either directly or indirectly selects new random cell , direction. continues until number of sets left 1 ensuring can point in maze other point. program works painfully slow. dont think should slow , unsure why. i can imagine scenario cells connected one. take little while randomly select 1 cell , slow things down imagine when dealing under 100,000 cells still shouldn't take long does. rand should prettu fast @ spitting out numbers. ive attatched code below. simple sorry lack of notes. #include <iostream> #include <cstdlib> #include <ctime> #include <vector> #include <string> #include <sstream> ...

Regarding starting point of Linux kernel -

i understand main not starting point in linux kernel, kernel developers experienced enough customize starting point. consider following: qemu-system-arm -m versatilepb -m 128m -kernel arch/arm/boot/uimage -initrd rootfs.img -append "root=/dev/ram rdinit=/sbin/init" -dtb "versatile-pb.dtb" above, supplied kernel image, device tree, rootfs.img input mainline kernel, file in kernel executed first. if initialization file, triggering initialization code within kernel image. if yes, file that? please advice. note: looking clear answer, i.e. exact file in arm architecture. entry point of linux kernel, other elf binary, _start . arm, defined in arch/arm/boot/bootp/init.s

asp.net mvc - Fetching user_birthday from Facebook with MVC 5 -

hello stack overflow friends, need here. trying write basic .net application fun lets users log in through facebook , catpures email , birthday. in startup.auth.cs use: var facebookauthenticationoptions = new facebookauthenticationoptions() { appid = "foo", appsecret = "bar", }; facebookauthenticationoptions.scope.add("email"); facebookauthenticationoptions.scope.add("user_birthday"); facebookauthenticationoptions.signinasauthenticationtype = microsoft.owin.security.appbuildersecurityextensions.getdefaultsigninasauthenticationtype(app); app.usefacebookauthentication(facebookauthenticationoptions); i in controller use: if (user != null) { await signinasync(user, ispersistent: false); //get external user data... var externalidentity = await httpcontext.getowincontext().authentication .getexternalidentityasync(default...

javascript - Use a variable in function argument -

what trying set variable specified in function something, see below if doesn't make sense. function getrandomfromarray(arrayname,storevariable) { storevariable = arrayname[math.floor(math.random() * arrayname.length)] } var pettypearray = ['cat','dog','ferret','spider','companion bot']; getrandomfromarray(pettypearray,pettype) for example, set pettype random string in pettypearray. doing right? able this? you use return value of function: function getrandomfromarray(arrayname) { return math.floor(math.random() * arrayname.length); } var pettypearray = ['cat', 'dog', 'ferret', 'spider', 'companion bot']; var randomelement = getrandomfromarray(pettypearray); this makes code more readable. modifying parameter values inside function possible doesn't work primitive types such strings , integers. can modify properties of complex object.

java - System.out.print .. printing not in order -

i'm using system.out.print print arraylist (cl) , code looks this: system.out.print("returning \n"); for(int = 0 ; <cl.size(); i++){ if(i+1 == cl.size()) system.out.print(cl.get(i)); else system.out.print(cl.get(i)+" ,"); } the output should like: returning 1,2,3.... but shows this: 0 ,5 ,6 returning edit: problem not in order of elements, in "returning" position. i'm using windows 8 operations system , netbeans ide. why?! in order have output returning 1,2,3.... first arraylist cl should contains numbers 1,2... , on second try use system.out.println("returning ");

c++ - What is XCode's group alternative in Visual Studio? -

i have create c++ project in xcode, organized classes in folders , added folders groups in xcode. so, can include header files directly names without complete path. want use organized classes in visual studio. but, visual studio can't find include files directly files' name, needs complete path. so, there alternative xcode's groups in visual studio?

logarithm - Is there any faster algorithm to find approx value of log(n) and what will be time complexity of that? -

is there faster algorithm find approx value of log(n) , time complexity of ? i want approx integer value of log(n) , inbuilt function log(n) in java gives ans approximate accuracy in double useless me , take time. since log , multiplication 1 of primary function in program , log make program slow. here benchmark multiply took: 466 milliseconds logarithm took: 3245 milliseconds it's approximate 10 time of multiplication. (note:-here used benchmark show took time compare other primary function of program , know not possible compare 2 different type of function) so want know there faster algorithm find approx value of log(n) , time complexity of ? (note :- algorithm should work log() base) i have no idea if faster, assuming have integer x , want log in base k : log_k(x) = log_2(x)/log_2(k) note i , floor(log_2(i)) 'index' of significant none 0 bit

How to join with three tables with multiple conditions? -

i want join 3 tables multiple conditions. below table structure , expected result users_id users_first_name 1 rocky 2 james 3 john meeting_details_id meeting_title users_id meeting_lead close_meeting (no) 1 newmeet 3 1 no 2 testmeet 2 2 no attended_meetings project_meeting_attendeeid meeting_details_id users_id access_type (attendee) 1 1 2 attendee expected output: query should check if meeting attended or users meeting lead meeting_title creator meeting_lead close_meeting (no) newmeet john rocky no testmeet james james no try this: select m.meeting_title,u1.users_first_name creator,u2.users_first_name meeting_lead,m.close_meeting meetingtable m left outer join u...

java - How to group images in android device according to the folder name? -

i relatively new android. working on gallery application. requirement arrange images in device according folder name. have managed images in folder. not able arrange according folder name. 1 problem facing there may more on folder same name.i attaching code bellow. final string[] columns = { mediastore.images.media.data, mediastore.images.media._id }; final string orderby = mediastore.images.media._id; bitmap thumbnails[] = new bitmap[3]; string temp = null; int imagecount = 0; cursor imagecursor = context.getcontentresolver().query( mediastore.images.media.external_content_uri, columns, null, null, orderby); int image_column_index = imagecursor .getcolumnindex(mediastore.images.media._id); int count = imagecursor.getcount(); string temparrpath = null; (int = 0; < count; i++) { imagecursor.movet...

For Loops not running inside If statement Excel VBA -

i'm writing code update inventory spreadsheet on first of every month. have little knowledge of vba understand basics of programming. please excuse poor code. the problem after initial if statement check, when true runs line directly below (adding new line) , not execute loops after edit data. sub auto_open() dim stock(21) if date - day(date) + 1 = date range("'monthly office inventory'!a2").entirerow.insert = 0 21 stock(i) = range("current office inventory'!a2").offset(0, i).value next x = 0 21 range("'monthly office inventory'!b14").offset(0, x).value = stock(x) next x end if end sub probably easiest way changing condition to: if day(date) = 1 then now, i'm writting on mac, think you'll idea (and correct if detail wrong).

php - Why am I getting an "undefined index" error? -

i getting undefined index error following code: <?php echo"<input name='type' disabled='disabled' type='text' id='type' value=$room_type />"; ?> if(isset($_post['type'])) { $type=$_post['type'] } assuming code correct , not provided, disabled form inputs not submitted browsers, that's why $_post['type'] undefined .

c - How to scan values into an array using a generic void pointer? -

given method header void scanarray(void *arr, int const numelements, int const sizeelement, char const *fmt) where *arr can type of array , numelements number of elements in array, , sizeelement size of type of value in array, , fmt string such %d , %lf , or %f , how write function uses scanf insert values array? void scanarray(void *arr, int const numelements, int const sizeelement, char const *fmt){ int i; unsigned char *temparr = (unsigned char*) arr; for(i=0; i<numelements; i++, temparr+=sizeelement) scanf(fmt, temparr); } this seems working me...

jquery - wrap each image in a div and prepend a number -

i'm trying write function wrap each image in div , insert span label each image. this have written far: $('#carousel img').each(function(index) { $(this).wrap('<div class="image"></div>'); $(this).before(function (index) { index = '00' + (index + 1); return '<span class=index>' + index.substr(index.length - 2) + '</span>'; }); }); what code doing this, notice number problem , putting span inside img tag : <div class="image"> <img src="img/ny1.jpg" /> <span class="index">01</span> </img> </div> <div class="image"> <img src="img/ny2.jpg" /> <span class="index">01</span> </img> </div> the desired result of this: from this: <img src="img/ny1.jpg" /> <img src="img/ny2.jpg" /> to this: <div ...

c++ Segmentation fault when taking int input from user in terminal but not xcode -

i having issues reading in file xcode decided switch terminal test it, in terminal getting segmentation fault when following function executes (only when choosing 1). ideas? turns out problem reading file in. going post question handling that. struct system { character player; }; struct character { string name; ushort money; ushort intelligence; ushort time; ushort steps; ushort score; }; bool get_number ( int& number ) { while ( !( cin >> number ) ) { if ( cin.eof() ) return false; else { char ch; cin.clear(); cout<<"invalid input, please try again: "; while (cin.get(ch) && ch != '\n' ); } } return true; } void viewmenu(menu menuchoice) { cout << menuchoice.options; cout << "\nplease choose option: "; int number; get_number(number); if (menuchoice.choice == 0) { if (number == 1) { struct system game; startgame(playername); } else if ...

datetime - Right time format of using timeMax retrieving Google Calendar Events in PHP? -

i trying retrieve google calendar events using php analysing purposes. used singleevents= true settings expand recurring events single instances. in order avoid retrieving unlimited recurring events, tried set event start upper bound 2015-06-01. here code using: $eventlist = $cal->events->listevents($tempcal["id"], array(maxresults =>5000,singleevents => true,timemax => '2015-06-01t00:00:00-04:00')); but seems timemax parameter not work. i tried other time format '2015-06-01t00:00:00z' , not work either. however, tried same string using web browser , retrieved events before 2015-06-01 using https://developers.google.com/google-apps/calendar/v3/reference/events/list what wrong timemax format? the solution worked me (ordering , time-bounds): /* retrieve events today */ $start = date(datetime::atom, mktime(0,0,0,date('m'), date('d'), date('y'))); $end = date(datetime::atom, mktime(23,59,59,date...

python - Custom Dialog in tkinter -

i trying make custom popup dialog box using tkinter in python. custom mean having several buttons text want. closest trying code from tkinter import * dialog import dialog class olddialogdemo(frame): def __init__(self, master=none): frame.__init__(self, master) pack.config(self) # same self.pack() button(self, text='pop1', command=self.dialog1).pack() button(self, text='pop2', command=self.dialog2).pack() def dialog1(self): ans = dialog(self, title = 'popup fun!', text = 'an example of popup-dialog ' 'box, using older "dialog.py".', bitmap = 'questhead', default = 0, strings = ('yes', 'no', 'cancel')) if ans.num == 0: self.dialog2() def dialog2(self): dialog(self, title='hal-9000', ...

objective c - How to pass 2 parameters with a self method Cocos2d -

this noobish question has been answered before, can't seem find solution online (google not being friendly). question is, relating cocos2d, how pass 2 parameters using self method. example of code -(void)random { [self aicharacter:theevilone]; [self aicharacter:theeviltwo]; } -(void)aicharacter(ccsprite*)evilcharacter { //stuff } but want following -(void)random { num = 1 [self aicharacter:theevilone, num]; num = 2 [self aicharacter:theeviltwo, num]; } -(void)aicharacter:(ccsprite*)evilcharacter (nsinteger*)num { //this line seems incorrectly formatted/syntactically incorrect. //stuff } to give more info doing have multi-dimensional array of values relating separate ai characters , have num value differentiate rows pertaining each sprite. try -(void)random { num = 1 [self aicharacter:theevilone: num]; num = 2 [self aicharacter:theeviltwo: num]; } -(void)aicharacter:(ccsprite*)evilcharacter : (nsinteger*)num {...

linux - java -version returning an error but bash profile is correct -

when run java -version returns: -bash: java: command not found. when go opt/java/bin/java -version returns 1.6 etc expected. if tab java's available @ prompt get: javac javadoc javah javap but not plain old java. my ~/.bash_profile reads: java_home=/opt/java/ export java_home tried re-installing java, seeing same result. missing something? am missing something? your bash profile not correct. if /opt/java java installation directory, need /opt/java/bin on command search path; i.e. path environment variable.

excel - Vlookup a Cell which Contains a Part of Other Cell but not that Straightforward -

hi guys , excel gurus, stuck 1 excel problem cannot solve. tried using index, match, vlookup no avail. basically tried getting column d displays value column b if value of column c contains part of value in column a. so i'm dealing kind of this: fixed table display +------------------------------------------------------+ | header column column b column c column d | +------------------------------------------------------+ | row 1 111 aaa 1111 | | row 2 222 bbb 112 | | row 3 333 ccc 2225 | | row 4 444 ddd 333 | +------------------------------------------------------+ so expected result be: +------------------------------------------------------+ | header column column b column c column d | +------------------------------------------------------+ | row 1 111 aaa 1111 aaa | | row 2 ...

linq - EF Code First oddity with Distinct() -

there don't understand code bellow. i'm trying find workers have duplicate module in modules collection. here's entities (simplified sake of brevity): public class worker { public int id { get; private set; } public icollection<takentrainingmodule> takentrainingmodules { get; private set; } public worker() { takentrainingmodules = new hashset<takentrainingmodule>(); } } public class takentrainingmodule { public int id { get; set; } public int trainingmoduleid { get; set; } } and here's query: var query = worker in _context.workers.include(worker => worker.takentrainingmodules) let distinctmodules = worker.takentrainingmodules.select(module => module.trainingmoduleid).distinct() worker.takentrainingmodules.count != distinctmodules.count() select worker; with query bellow, returned workers have takentrainingmodules collection empty. but, next query (without using ke...

javascript - how to stop dropdown menu child sliding up when clicked -

i attempting make dropdown menu when clicked stays down also, when clicking anywhere within dropdown area, not slide up. when clicked elsewhere on page should disappear. i struggling make happen though. can see doing here: html <nav id="moo"> <ul> <li>item 1 <i>o</i> <div class="dropdown"> <ul> <li>item 2</li> <li>item 3</li> <li>item 4</li> </ul> </div> </li> <li>item 1 <i>o</i> <div class="dropdown"> <ul> <li>item 7</li> <li>item 8</li> <li>item 9</li> </ul> </div> </li> </ul> </nav> css ul { padding: 0px; margin: 0px; } li { display: inline; } nav li { position: relative; } nav { cursor: pointer; font-weight: bold; background-color: red;...

ruby on rails - Sidekiq worker priority setup -

currently running background jobs using sidekiq. concurrently running 10 jobs @ time. these jobs not small jobs. take 6-8 hours complete work. in mean time need run smaller jobs(will take 2-3 mins). not able run these jobs until 1 of above 10 jobs complete. need wait 6-8 hours perform small job. but these jobs should run after adding queue. there option block 1 of process run kind of small jobs. tried queue option not working in scenario. here sidekiq config :concurrency: 10 :queues: - [web, 7] - [default, 3] can 1 give me solution problem? the long jobs suffocate smaller jobs since fight on same resources. i can suggest run two sidekiq processes, each using different config file, , each listening different queue: sidekiq_long.yml : :concurrency: 10 :queues: - default sidekiq_normal.yml : :concurrency: 3 :queues: - web this way 1 sidekiq process available server short jobs: sidekiq -c config/sidekiq_long.yml.yml sidekiq -c config/sidekiq_no...

java - Returning Boolean value from Asynctask in Android -

i new android. want pass url asynctask , check if return status code sc_ok or not. method should return true if status code sc_ok returned , false if other status code. class checking extends asynctask<string, void, boolean> { @override protected boolean doinbackground(string... params) { // todo auto-generated method stub boolean a; httpclient client = new defaulthttpclient(); httpget httpget = new httpget(l1); httpresponse response; try { response = client.execute(httpget); statusline statusline = response.getstatusline(); int statuscode = statusline.getstatuscode(); if (statuscode != httpstatus.sc_ok) { toast.maketext(getapplicationcontext(),"no", toast.length_long).show(); a= false; } else { toast.maketext(getapplicationcontext(),"yes",...

ruby on rails - Unable to locate element with cucumber step_definition, but able to locate it with capybara stand-alone -

Image
i testing website has both vertical login form on right, , horizontal form on bottom. both have identically named "email" , "password" fields. employing capybara's within scope fields i'm interested in. interesting bits of web form this: i have 2 separate projects, in experimenting sauce labs automation. first project capybara-only example, modified test page shown above. second project cucumber implementation of exact same tests. these simple, one-time hard-coded tests, proof of concept of 2 techniques. here interesting bit of capybara-only example: within(:css, ".right-container.login-form") fill_in 'email', :with => "greg.gauthier+#{generate_email_suffix}@website.com" fill_in 'password', :with => 'l33tp@$$w0rd' click_button 'submit' end here interesting bit of cucumber step_definition: when(/^the user enters information$/) within(:css, ".right-container.logi...

php - How to perform inner join on a table with one to many relation? -

this search uses various webpages in database matching values of metadata. here value field has more 1 value , not sure how graduate science courses or similar. have tried many things nothing works. select distinct page.path,page.site_id, (select metadata_custom.value display_name metadata_custom field='academic search title' , page.id=metadata_custom.page_id) value, page.id publish.page inner join metadata on page.metadata_id=metadata.id inner join metadata_custom on page.id=metadata_custom.page_id field='acadsearch' , value ('science%' , 'graduate%"); also, have query use value '{$term}%' some sample tables table page: id | account_id | site_id | cms_id | folder_id | metadata_id | name |path | content ---------------------------------------------------------------------------------------------------- | 583 | 1 | 1 | e026b376c0a80123019b60bb23817853 | db2b800fc0a80123019b60bbb5e082cd|...

javascript - adding and removing html content on sortable in jquery ui -

i new jquery , stuck 1 problem . want whenever draggble item dragged sortable items want html code displayed drop here user can drop in between sortable elements code below id sortable element sort1,sort2,sort3,..... whenever user drags item on each of id perticular time want display drop here .and when dragged away display block should go . there way in can accomplish this js fiddle . this html code <div id="sortable"> <div class="sort" id="sort1">sort1</div> <div class="sort" id="sort2">sort2</div> <div class="sort" id="sort3">sort3</div> <div class="sort" id="sort4">sort4</div> <div class="sort" id="sort5">sort5</div> <div class="sort" id="sort6">sort6</div> you css: .ui-sortable-placeholder { visibility: visible !imp...

vba - How to check if a cell is invalid, and set a default value if it's invalid? -

i have cell has named range list validation. want this: check if current contents of cell violate validation, , if so, set cell first value in named range list. here's i've tried far: private sub defaultifinvalid(rng range) dim formula string formula = rng.validation.formula1 formula = mid(formula, 2) 'remove equal sign on front if range(formula).find(rng.value) nothing rng.value = range(formula)(1).value end if end sub but line: if range(formula).find(rng.value) nothing gives following error: method 'range' of object '_worksheet' failed how can perform check/setting default? edit: if it's helpful, validation dynamic formula selects several different named ranges based on contents of 1 of cells. formatted here clarity: =if('on-call search form'!$c$6="on-call contact",oncallgroup, if(or('on-call search form'!$c$6="district", 'on-call search form'!$c$6="division"), ...

javascript - jQuery execute script after everything ready -

i using ajax in webpage , have javascript in ajax page executed when ajax page load. problem is, how can have jquery execute script after ajax page loaded? i have tried with: $( '#ajaxdiv' ).load(function() { } but didn't run code @ all. if put .ready() , run code, not after loaded. is possible have piece of code executed after ready? you should in deferred promise object. decent article explaining / how use it. deferred object http://api.jquery.com/category/deferred-object/ http://css-tricks.com/multiple-simultaneous-ajax-requests-one-callback-jquery/ (sample code article below. ) $.when( // html $.get("/feature/", function(html) { globalstore.html = html; }), // css $.get("/assets/feature.css", function(css) { globalstore.css = css; }), // js $.getscript("/assets/feature.js") ).then(function() { // ready now, so... // add css page $("<style />").html(globalstore....

Regex conversion on bbcode -

we moving phpbb simpler system , of bbcode needs converting, particularly "quote" code. current phpbb based quote code looks this: [quote="username":nw4lek0o]the quoted text[/quote:nw4lek0o] and needs simplified this: [quote=username]the quoted text[/quote] so, 2 things: strip double quotes around username, , strip id string opening , closing tag. i'm not @ regex. help? use regex: \[quote="(.+?)":.+?\](.+?)\[/quote:.+?] and replace with: [quote=$1]$2[/quote] demo: http://regex101.com/r/jl3xu2

php - I cant select data with condition using yii framework -

i new in yii.i trying select data database , list it.i have controller name sitecontroller.php , view page search_result.php.i can select , list data without condition,but want select data condition controller - sitecontroller.php <?php class sitecontroller extends controller { public function actionsearch_result() { $title=$_get['title']; $experience=$_get['experience']; $criteria=new cdbcriteria(); $criteria->condition = "title '%$title%' or key_skills '%$title%'"; $count=job::model()->count($criteria); $pages=new cpagination($count); $pages->pagesize=2; $pages->applylimit($criteria); $model=job::model()->findall($criteria); $this->render('search_result',array('model' =>$model,'pages' => $pages)); } } ?> my view file - search_result.php <div style="float:right;margin-right:285px;"> <h1>search results</h1...

javascript - adding many shapes triggered from button in fabricjs library -

i'am making draw application using fabricjs library there button each shape create question how write code each time click on button create shape , added canvas many click ,, i.e if want 5 circles click on circle button 5 times ans on ....i'am making draw application using fabricjs library there button each shape create question how write code each time click on button create shape , added canvas many click ,, i.e if want 5 circles click on circle button 5 times ans on .... please try one <html> <head> <script src="scripts\jquery-1.11.1.min.js"> </script> <script src="scripts\fabric.min.js"></script> <script type="text/javascript"> jquery(function($){ var canvas = new fabric.canvas('c'); $("#addcircle").click(function(){ canvas.add(new fabric.circle({ radius: 20, fill: 'green', left: 100, top: 100 })); }); }); </scri...

scala - Why do these similar looking statements yield objects of different types? -

in book 'scala impatient' author provides following 2 examples 'for-comprehension': for (c <- "hello"; <- 0 1) yield (c + i).tochar // yields "hieflmlmop" (i <- 0 1; c <- "hello") yield (c + i).tochar // yields vector('h', 'e', 'l', 'l', 'o', 'i', 'f', 'm', 'm', 'p') however, didn't mention why output string in first case, , vector in second. please explain? thanks. your first example translated like: "hello".flatmap(c => (0 1).map(i => (c + i).tochar)) and second to (0 1).flatmap(i => "hello".map(c => (c + i).tochar)) stringops.flatmap returns string , first example returns string well. range.flatmap returns indexedseq instead.

swiftmailer - Error sending more than 300 emails with PHP Swift Mailer showing Internal Server Error -

error sending more 300 emails php swift mailer showing internal server error getting 200 mails out of 300 i using ftp surfer another problem after sending 200 mails upto 1 hour mails not going showing send not getting mails after 1 hour again getting mail ids getting mysql database using each loop mails sending <?php // create message // create message $message = swift_message::newinstance(); $sql=mysql_query("select * test_email status=''"); while($row=mysql_fetch_array($sql)) { // want replace following static array // dynamic 1 built retrieving users database $users = array( array( "fullname" => "aurelio de rosa", "operations" => $row['sno'], "email" =...

javascript - How do I refresh a HTML table after editing it? -

i making simple system records bookings, editable other 'booking number' , 'price' sections static. booking number pre-defined , price variable dependent on value of 'number of seats chosen' column. 'price' column appears undefined when open .html file, , want refresh code after 'number of seats chosen' has been edited accordingly. price multiplies pre-defined , static, mean when number of seats chosen has been defined, multiplied 5. here code: <script type="text/javascript"> var seatvar = document.getelementsbyclassname("seatchosen"); var pricepay = seatvar * 5 </script> <script type="text/javascript"> function refreshtable () { var table = document.getelementbyid ("bookingtable"); table.refresh (); } </script> <table class="editabletable" id="bookingtable" border="1"> <tr><th>booking number</...