Posts

Showing posts from January, 2014

visual c++ - Array allocation in C++ on stack with varying length -

this question has answer here: c++: why int array[size] work? 3 answers i surprised find out possible allocate varying-length array on stack in c++ (such int array[i]; ). seems work fine on both clang , gcc (on os/x) msvc 2012 don't allow it. what language feature called? , official c++ language feature? if yes, version of c++? full example: #include <iostream> using namespace std; int sum(int *array, int length){ int s = 0; (int i=0;i<length;i++){ s+= array[i]; } return s; } int func(int i){ int array[i]; // <-- feature i'm talking (int j=0;j<i;j++){ array[j] = j; } return sum(array, i); } int main(int argc, const char * argv[]) { cout << "func 1 "<<func(1)<<endl; cout << "func 2 "<<func(2)<<endl; cout << "

Python - read from file skip lines starts with # -

try read file , make dictionary lines, skippipng lines starts # symbol file example: param1=val1 # here comment my function: def readfromfile(name): config = {} open(name, "r") f: line in f.readlines(): li=line.lstrip() if not li.startswith("#"): config[line.split('=')[0]] = line.split('=')[1].strip() return config i list index out of range error but! if try skip lines starts with, example, symbol "h" - function works well... try with: def readfromfile(name): config = {} open(name, "r") f: line in f.readlines(): li = line.lstrip() if not li.startswith("#") , '=' in li: key, value = line.split('=', 1) config[key] = value.strip() return config you maybe have blank line breaks split()

MYSQL datetime to mongoDB -

i have converted mysql db mongodb. one field, publish_datetime mysql datetime field. in mongo, need todo ordering datetime field. is possible without converting seperate field timestamp? it not matter type is, sorting either datetime value or integer value happens with: db.collection.find().sort( { field_name: 1 } ); however, helpful if showed sample document has "datetime" value in there.

onclick - VBA - populate cell from different sheet on mouse click -

the problem facing is, require cell autopopulate cell reference in different sheet within same workbook when user clicks cell. e.g. 1) user clicks a1 on sheet 1 2) cell a2 on sheet 1 populates value cell a1 in sheet 2 i need function span approximatly 80+ references, in other words have list of on 80 project names in sheet 1 a1= projectname 1 a2= projectname2 , on. sheet 2 has of project descriptions...a1 project1 descroption..a2 project2 description , on. i believe looking worksheet_selectionchange event. in sheet selecting add following: private sub worksheet_selectionchange(byval target range) if target.column = 1 ... end if end sub this method gets called anytime select new cell.

php - How to find storage location of images in tiny mice -

i'm in process of migrating data k-ecommerce platform magento ecommerce platform. stuck getting product images k-ecommerce platform. in backend, using tiny mce editor upload images , direct uploads there. find of product images in shown image folder. others not found. suspect, 'shown images' direct upload images , 'not found images' uploaded through tiny mce editor. tiny mce store images in database? can give me clue find images uploaded through tiny mce editor. 'filesystem.rootpath' configuration in config.php sets upload folder edit image path of in tiny mce popup this. again suspect data database. ../../stream/index.php?cmd=im.streamfile&path={0}/product_folder/image_name.jpg thanks. well, not familiar tinymce uploadmanager, think images stored here: tiny_mce/plugins/imagemanager/files/

html - Make a Menu div spread in the middle and work in smaller screens -

i'm building website client, , 1 of last problems can't solve menu issue. believe might helpful other people. the menu has 3 div s inside (the parent div ) . here code, bit shortened: <div id="header"> <div id="logo"><img src='logo.png' /></div> <div id='languageselect'>language select</div> <div id="menu"> <ul id="menu_noya"> <li class="head_item"> <a href="index.php?page=women">{$language["menuwomen"]}</a> <ul> <li><span style='color:#352618;font-family:tahoma;font-size:11px;font-weight:bold;'>{$language["inmenuwomen"]}</span></li> <li><a href='index.php?page=women'><img src='/styles/images/women1.jpeg' style='height:170px;width:120px;

asp.net - Getting Error while adding new MVC 4 Project -

Image
i new mvc. have installed nuget extension when had installed mvc 4. after had run cleaner because of think temp files have been deleted. when trying add new mvc 4 project shows me following error : i have uninstalled nuget still facing same problem, please me how can come out of this. for reason, nuget package manager not installed default. came across problem few times already. what want this. first : need unistall npm(nuget package manager) , did already, can try again, sure :) visual studio -> tools -> extensions , updates -> npm -> unistall second : after unistall npm, need install again use (ofc). there several ways install npm: 1) install under visual studio -> tools -> extenstions , updates> npm -> install 2) goto http://nuget.org , search install nuget link , click on it, downlaod .vsix file , install in on visual studio third : after installation, close , re-open visual studio, never error again.

excel - Find a specific value, first appearance and display the value -

i need seems simple problem. in excel file, want search first appearance of value in column , produce occurs at. in column a, have listing of numbers (the x-axis) , in column f, have series of data. want find first appearance of value in column f greater 7.5 , place it's relative column value in cell. both columns , f run cells 1 4000. if possible vba function or simple input function great help! with quite lot of guessing, may suit: =index(a:a,match(7.5,f:f,1)+1,1) edit guessed wrong.

Custom modal screen in TinyMCE 4 plugin in inline mode -

i developing custom plugin new tinymce 4. plugin utilizes modal screen. because want use modal screen/js service developed chose not use tinymce's window manager . the problem tinymce looses focus open open modal screen. want tinymce keep toolbars opened, because otherwise cannot interact editor. tinymce closes because receives blur event (and because not know opened windows). an minified problem showing problem can found in following fiddle. problem occurs example button clicked. http://fiddle.tinymce.com/pudaab/1 the shortened code attached below: tinymce.pluginmanager.add('example', function(editor, url) { // add button opens window editor.addbutton('example', { text: 'my button', icon: false, onclick: function() { var selection = editor.selection, dom = editor.dom, selectedelm, anchorelm; // focus editor since selection lost on webkit in

upgrade cassandra 1.1.2 -> 1.1.12 without LeveledCompactionStrategy -

i use cassandra 1.1.2 , upgrade 1.1.12. sstables not have leveledcompactionstrategy specified. following http://www.datastax.com/docs/1.1/install/upgrading#sstable-scrub not clear me if have scrub or if can proceed points 6 , 7 of http://www.datastax.com/docs/1.1/install/upgrading#completing-upgrade . clarify procedure? thank in advance. kind regards, silvio no special actions needed; drop new jar in , restart.

php - Why Response::download() won't download anything except PDF in Laravel 4? -

this line of code giving me sick. return response::download(storage_path().'/file/' . $file->id . "." . $file->file->extension); the files uploaded , given id saved under e.g. 25.pdf works fine if file pdf doesn't else e.g. png. upgraded laravel 3 4 try overcome problem. any ideas? edit: uploaded test text file word test in once uploaded , downloaded opened it, there 3 blank lines , letters te!!!!!i downloaded through sftp , file correctly stored on server defiantly download procedure! i used function instead of of laravel stuff. :/ (stolen other places around web) public static function big_download($path, $name = null, array $headers = array()) { if (is_null($name)) $name = basename($path); $finfo = finfo_open(fileinfo_mime_type); $pathparts = pathinfo($path); // prepare headers $headers = array_merge(array( 'content-description' => 'file transfer', 'content-typ

sql - Count issue when introducing a new column -

fairly new sql. i'm trying count total number of booking id's in query holidays in 2 regions. this want need.. id count region name 427139 1 france 427776 2 spain 427776 2 france but seem deliver this.. id count region name 427139 1 france 427776 1 spain 427776 1 france bookings id's unique split 2 rows when introduce region region table (via quotes , properties tables.) here's sql.. select count(bo.id) count, bo.id 'booking id', re.name 'region name' booking bo (nolock) left join quote qu (nolock) on qu.id = bo.quoteid left join property pr (nolock) on pr.code = qu.code left join region re (nolock) on re.id = pr.regionid bo.id = '427776' or bo.id = '427139' group bo.id,re.name order bo.id can help? thanks looking! in sqlserver2005+ can use over() clause aggregate function count() select count(*) over(partition bo.id)

android emulator - Running Instagram on AVD -

i wanted use instagram on computer, decided use android virtual device task. i downloaded android sdk , newest apk instagram computer. then created new avd , ran it. after booted, installed instagram apk using adb install instagram.apk . it installed smoothly , after clicking app, started . now here's problem : there on nothing works. when try login , press login button, nothing happens there no internet connection. browsers , other apps using internet connection work fine, instagram doesn't work. how can fix this? i think has android emulator can't handle global proxy. therefore hostnames resolved directly ip violates http 1.1 standarts , request doesn't send properly. fix this, needed change hostname gets send instead of ip.

android - Fatal Exception during scrolling a ListView -

the app runs fine until scroll few times in listview. this error got logcat. code custom baseadapter used below it. 07-31 10:08:43.550: e/androidruntime(32570): fatal exception: main 07-31 10:08:43.550: e/androidruntime(32570): java.lang.nullpointerexception 07-31 10:08:43.550: e/androidruntime(32570): @ com.duobility.leathr.homescreen$timelineadapter.getview(homescreen.java:485) 07-31 10:08:43.550: e/androidruntime(32570): @ com.haarman.listviewanimations.baseadapterdecorator.getview(baseadapterdecorator.java:87) 07-31 10:08:43.550: e/androidruntime(32570): @ com.haarman.listviewanimations.swinginadapters.animationadapter.getview(animationadapter.java:94) 07-31 10:08:43.550: e/androidruntime(32570): @ android.widget.abslistview.obtainview(abslistview.java:2452) 07-31 10:08:43.550: e/androidruntime(32570): @ android.widget.listview.makeandaddview(listview.java:1775) 07-31 10:08:43.550: e/androidruntime(32570): @ android.widget.listview.filldown(listview.java:6

wpf - Running cmd command from vb.net issue -

i trying run following code in click event. because executes command in cmd shell, don't know why wont run. can open cmd.exe administrator commenting out arguments. stick these arguments in .bat file, running process.start. however, why cant run shell arguments? i'd prefer method on putting arguments in .bat file. dim process new system.diagnostics.process() dim startinfo new system.diagnostics.processstartinfo() ' startinfo.windowstyle = system.diagnostics.processwindowstyle.hidden startinfo.filename = "cmd.exe" if system.environment.osversion.version.major >= 6 ' windows vista or higher startinfo.verb = "runas" else ' no need prompt run admin end if startinfo.arguments = "/c bcdedit /set {current} safeboot network" process.startinfo = startinfo process.start() figured out. had copy bcdedit.exe project. had thought c

javascript - XPages - trigger validation before executing CSJS? -

i have button executes csjs before doing trigger document validation. validate document before saving using ssjs , display errors control. validation works fine when press "save" button triggers save document simple action. possible trigger validation before executing csjs? there few options. you put csjs in oncomplete event of button's eventhandler (you need go properties of eventhandler, not properties of button find oncomplete). you call csjs via ssjs method view.postscript("mycsjsfunction()") . if use csjs tab button, trigger before submission server-side processing. it's designed client-side checking occur , prevent server-side, e.g. using return confirm("are sure?") check whether user wants cancel out of document or delete document etc.

vba - Concatenate every other row in Excel -

Image
i have excel sheet looks this: 3 | latitude | 46.142737 3 | longitude| -57.608968 8 | latitude | 43.142737 8 | longitude| -52.608968 15 | latitude | 41.142737 15 | longitude| -59.608968 i need end result this: 3 | 46.142737, -57.608968 8 | 43.142737, -52.608968 15 | 41.142737, -59.608968 it can concatenated based on every other row, or based on integer value in first column. vba suggestions? thank you. edit: there no actual "|" in excel sheet. "|" meant visual cue representing new column. you read data array , write range original data: result: code: sub example() dim long dim x long dim arry variant redim arry(1 2, 1 1) variant = 1 activesheet.usedrange.rows.count if cells(i, 1).row mod 2 = 1 x = x + 1 redim preserve arry(1 2, 1 x) variant arry(1, x) = cells(i, 1).value arry(2, x) = cells(i, 3).value & ", " & cells(i + 1

apache2 - Apache 2.4 -- how to close entire site except one subdirectory? -

we using new authentication , authorization framework offered apache-2.4 , need close entire site (location /) unauthorized access except 1 subdirectory (location /foo), there authorizing cookie can obtained. seem, authmerging directive use, things not work: <location /> authtype form authformprovider foo session on sessioncookiename ti2f include conf/sessionpw.conf authname ti <requireall> require foo ipaddress require foo expiration </requireall> errordocument 401 /foo/ </location> <location /foo> authmerging or require granted directoryindex index.php </location> unfortunately, access /foo remains blocked -- 401 unauthorized. loglevel cra

java - How to update a jTable from another neatbeans module -

the application working on uses netbeans modules, problem having have jtable in 1 module update contents module. the module table in acts data panel, information can selected , plotted graph using jfreechart, next modules handles creation of chart, when data being put series plotted doing analysis, simple stuff average error, std etc said information displayed in jtable part of first module spoke of. so question is, there way access jtable netbeans module , if best way go doing ? thanks in advance. add chosen dataset tablemodellistener tablemodel . in event handler, update dataset indicated tablemodelevent in order firedatasetchanged() implicitly. chart update automatically. example dataset: class mydataset extends xyseriescollection implements tablemodellistener { @override public void tablechanged(tablemodelevent e) { // update dataset firedatasetchanged(); } } example usage: mydataset dataset = new mydataset(); jtable table = new jt

Attach Reserved IP as VIP in Google Compute Engine -

finally have reserved static ip addresss in gce. after made haproxy , keepalived configurations, @ moment have 2 instances external , internal ips, , reserverd ip build vip keepalived. saw not possible attach same ip @ differents instances, can imagine make work keepalived need add en in default network new route rule. i tried possible ways not success.... in google doc web didn't find anything, has website more information or howto? thank you layer 3 load balancing available through early access program . sounds want.

c# - Obtain IP Address of the User of an IFrame -

i hosting several iframes on 3rd party web site. 3rd party site middle man allow user access web site internal use company. what verify user's ip address against range of valid ip's 3rd party (middle man) web site. if falls in range allow user access iframe, if not - access denied! anyways, there ton of examples online request.userhostaddress, brings ip address. my question is: how user's ip address whom accessing iframe assure request coming 3rd party site? so far have tried servervariables , userhostaddress. both return ::1. running site hosts iframes locally , accessing through 3rd party site hosted on server. update i have gotten around updating everyone. trying code not viable solution. but, believe there solution through authenticating ip address iis. in code without implementing hacky solution able obtain user's ip address. however, using iis can verify 3rd party's address. post demonstrates how it. post not fit case, show how authenticate i

iphone - How can an iOS app provide a ringtone? -

this question has answer here: set ringtone in iphone sdk [closed] 1 answer we have restaurant customer wants ringtone app users plays burger chewing sounds example. how can this? someone told me ios apps can't set ringtone have seen dozen ringtone apps on app store. procedure supply user ringtone? you can provide user sounds can add ringtone library, dozens of apps this. not allowed modify user's selected ringtone, have themselves.

python - pandas dataframe aggregate - why does it return column names? -

here's simple data frame: acid balance_1 custid balance_2 0 1 0.082627 1 nan 1 2 0.397579 1 0.459942 2 3 0.201596 2 0.596573 3 4 0.616448 3 0.705697 4 5 0.844865 3 0.483279 5 6 nan 4 0.360260 i have been trying play around aggregate function, after grouping custid. groupby_obj = time_series.groupby(["custid"]) df = groupeby_obj.agg(set) this returns acid \ custid 1 set([balance_1, balance_2, acid, custid]) 2 set([balance_1, balance_2, acid, custid]) 3 set([balance_1, balance_2, acid, custid]) 4 set([balance_1, balance_2, acid, custid]) balance_1 \ custid 1 set([balance_1, balance_2, acid, custid]) 2 set([balance_1, balance_2, acid, c

asp.net - javascript - get value of a text box that contains a date? -

this question has answer here: getting values of textboxes in javascript 5 answers i have text box date (gotten date picker) , trying value of text box using javascript. reason function returning null or errs.can me? <asp:textbox id="txtstartdate" name="txtstartdate" runat="server" maxlength="100" causesvalidation="true" validationgroup="priorauth" cssclass="effect"></asp:textbox> <ajaxtoolkit:calendarextender id="cestartdate" runat="server" format="mm/dd/yyyy" popupbuttonid="imagebutton1" targetcontrolid="txtstartdate" popupposition="bottomright" /> alert("date: " + dat

iphone - Merge two projects into a single one -

i have two different projects of files(xibs,.h,.m)same names differnt bit of code.not entirely different. i use functionality of second project in first project .i have gone through google couldn't find what's way merge 2 projects instead of copy paste whole code needed.the concept when button in first project clicked has redirect second project's view .how can make possible.?how in ios maintaining 2 packages in same project in android? ideas/suggestions highly appreciable.... you should copy one of your project file into another project this is your solution..

android - LayoutParams returning null -

this code, dont know why returning null? can put null check here, there wrong? textview descriptiontv = (textview) findviewbyid(r.id.descriptiontv); textview tc = new textview(c); final popupwindow windowpopup = new popupwindow(tc,layoutparams.match_parent,layoutparams.wrap_content ,false); tc.setbackgroundresource(r.drawable.bg_training_baloon_hc_2x); tc.settext("this demo test check how looks, m wanting test whether works or not"); tc.setpadding(20, 20, 20, 20); linearlayout.layoutparams params = new android.widget.linearlayout.layoutparams(layoutparams.wrap_content,layoutparams.wrap_content); params.setmargins(30, 0, 30, 0); tc.setlayoutparams(params); based on experience, have add view parent view first before can set layout parameters it, so: textview calendaryear = new textview(getactivity()); calendaryear.settext(calendar.getyear() + ""); calendaryear.settextsize(20); calendaryear.settypeface(null, typefac

actionscript 3 - Save new data to pre-existing XML file -

i want make quiz game as3. have made database questions , answers, looks this: <quiz> <question>question 1</question> <answers> <answer>answer a</answer> <answer>answer b</answer> <answer>answer c</answer> </answers> </quiz> but want able add new questions via as3. how can add new question , have saved permanently database - such can access new questions later on? beginner, appreciate if keep answer simple. database xml file put on disk instead of server.

r - Abruptly stop executing a command and continue to the next one -

i have set of files on need apply rpart algorithm. of these files takes long computation. how can skip such cases (eg. cases take more hour) , continue on next one? for (i in num) { print(i) infilename = filenames[i] tmpdata = read.table(infilename, header = true, sep= "\t") retval = rpart(fmla[i], dat=tmpdata, method = "class") print (retval) } edit: based on suggestin @dwin, doing following not work. doing wrong? for (i in num) { print(i) infilename = filenames[i] tmpdata = read.table(infilename, header = true, sep= "\t") retval= null settimelimit(cpu=10) retval = try(rpart(fmla, dat=tmpdata, method = "class") ) print (retval) } because using regular r functions (and not coding scratch), need come way estimate conditions leading excessive times. might test looks @ dimensions of dataframe , skips next rpart computation if product of dim(dfrm) exceeds threshold. retval = if(prod(dim(tmpdata)) < 1e6) {

ember.js - Do you need to set the model on the controller when using setupController on Ember.Route? -

i have been having confusion in regards ember.route model vs. setupcontroller. have example app here: http://jsbin.com/ihakop/5/edit i wondering why need add following (see inline comment) app.appsshowroute = ember.route.extend({ model: function(params) { return app.ltiapp.find(params.id); }, setupcontroller: function(controller, model) { controller.set('reviews', app.review.find()); // why line needed? shouldn't have model // on controller? controller.set('model', model); } }); shouldn't model on controller? this question. behaviour introduced rc4. have @ blog post explanation. recommendation of ember guys add call _super() : app.appsshowroute = ember.route.extend({ model: function(params) { return app.ltiapp.find(params.id); }, setupcontroller: function(controller, model) { this._super(controller, model); controller.set('reviews', app.review.find()); } });

java - Parse content-page using Regex? -

i'm writing java code using regex parse content-page extracted pdf document. in string regex must match: digit (up three) followed space (or many) followed word (or many [word: sequence of characters]). , vise versa: (word(s) space(s) digit(s)), must in string. considering leading spaces , case insensitive. the extracted content-page this: directors’ responsibilities 8 corporate governance 9 remuneration report 10 the numbering-style not consistent , number of spaces between digit , string vary, like: 01 contents 02 strategy , highlights 04 chairman’s statement the regex i'm using matches number of words followed number of spaces , number of no more 3 digits: (?i)([a-z\\s])*[0-9]{1,3}(?i) it works not quite well, can't tell i'm doing wrong? , wish there way detect both numbering-style (having page numbers left or right of string) instead of repeating regex , flip order. cheers if want match phrases

scope - Access to top-level functions inside WebComponent -

is possible access top-level function inside dart webui webcomponent? this possible fancy syntax. see section on registering top-level variables: https://github.com/dart-lang/fancy-syntax#registering-top-level-variables

java - Static ResourceBundle -

i making resources app using resourcebundle. thing is, current code dispatch resources need create instance of resource bundle every time need , can guess not idea, since end loading resources again , again. the second solution divide bundle many, end bundles have 2-3 strings , 15 bundles. my question is: there way simple load resources in single static class , access them there. i made little piece of code seems work me doubt quality. public class staticbundle { private final static resourcebundle resbundle = resourcebundle.getbundle("com.resources"); public final static string string_a = resbundle.getstring("key_a"); public final static string string_b = resbundle.getstring("key_b"); public final static string string_c = resbundle.getstring("key_c"); } with can call staticbundle.string_a , value anywhere in project since bundle initialized @ same time class itself... highly possible program won't hav

c++ - Swap two colors using color matrix -

Image
how can swap 2 colors using color matrix? instance swapping red , blue easy. matrix like: 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 so how can swap 2 colors in general? example, there color1 r1, g1, b1 , color2 r2, g2, b2. edit: swap mean color1 translate color2 , color2 translate color1. looks need reflection transformation. how calculate it? gimp reference removed. sorry confusion. this appears section of color-exchange.c file in gimp source cycles through pixels , if pixel meets chosen criteria(which can range of colors), swaps chosen color: (y = y1; y < y2; y++) { gimp_pixel_rgn_get_row (&srcpr, src_row, x1, y, width); (x = 0; x < width; x++) { guchar pixel_red, pixel_green, pixel_blue; guchar new_red, new_green, new_blue; guint idx; /* current pixel-values */ pixel_red = src_row[x * bpp]; pixel_green = src_row[x * bpp + 1]; pixel_blue = sr

C# winforms event in Main method for any new form shown -

i have 2 windows forms apps projects (one test , 1 prod) , dll project in same solution. 2 winforms app projects have 1 class/function, program.main(), icons i'm asking about, , app.config files. both reference same dll contains else (including forms). want able set icon (form.icon) , text (form.text) each time new form in app shown. purpose of have different window titles , icons test , prod (as different publish location settings). how can accomplish this? i've tried setting icon properties>application>resources>icon , manifest, doesn't work. happy getting different icon, text big plus. there event subscribe in program.main() method, before application.run(new form()), can set icon , text properties form shown, or other solutions? edit: hoping somthing because there lots of forms: static void main() { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); someclass.newwinformshown += n

android - Fragments Behave Weirdly When Using addToBackStack() -

Image
an sscce issue available on github . for future readers, original example on branch of same project , , fix available in diff . this sscce has listview , row of buttons. buttons supposed change data in listview, , listview rows (when clicked) supposed open new fragment , advance backstack while staying in same activity. if following things, produces following result: open app. tap listview. - fragmenttransaction.replace(...) addtobackstack(true) tap of buttons. - fragmenttransaction.replace(...) addtobackstack(false) tap button. result: both fragments become visible, want first loaded fragment ( listtwofragment in code) display. how fragments supposed work? if so, how can desired effect? mainactivity.java: public class mainactivity extends fragmentactivity implements listtwofragment.callbacks, listthreefragment.callbacks { public static final string key_args = "args"; private string cururi = ""; private string curargs =

php - Display mysql data in a new div per row returned -

i have created following not displaying data correctly, wish new div per line of data database. <?php include_once '\inc\header.php'; $db_server = mysql_connect($db_hostname, $db_username, $db_password); if (!$db_server) die("unable connect mysql: ". mysql_error()); mysql_select_db($db_database) or die ("unable select database: " . mysql_error()); $query = "select * deal"; $result = mysql_query($query); if (!$result) die ("database access failed: " . mysql_error()); ?> <body class="metrouicss" onload="prettyprint()" style="zoom: 1;"> <div id="container"> <?php foreach($result $tile) {?> <div class="item tile double bg-color-red"> <?php echo $tile['name']?> </div> <?php }?> </div> <?php mysql_close ($db_server); ?> ` <?php include_once '\inc\heade

php - Change default magento shipping price -

so website delivers flowers people , depending on how far away shipment is, it's going cost more shipping. there 2 prices: 12.95 , 30.00. owner of website wants automatically "12.95" before zip code or typed in because says "turning people away" see 30.00 that. if type zip code in, isn't problem. it'll display correct amount. need 12.95, or totally blank until zip code typed in, default instead of 30.00. suggestions? edit 1 the zip code input , radio button select price on 2 different pages. theyre under 1 larger umbrella page, doesnt seem able detect zip code tag or radio button/label. thats why cant make invisible until zip code typed. because can't bridge javascript across 2 pages that. edit 2 well im not sure how 3 pages come together, im assuming zip code page , radio button page "included". arent part of actual document, cant accessed via dom. when theyre displayed on page, code comes whole. or appears way. tried manipulat

How to determine which Maven dependency is needing a missing dependency? -

i trying build old maven project , i'm getting error: [error] failed execute goal on project myapp: not resolve dependencies project com.initech.myapp:war:${buildversion}: failure find tangosol:tangosol-coherence:jar:3.3-rc1 in http://mvnrepo.initech.com/archiva/repository/initechrepo cached in local repository, resolution not reattempted until update interval of initechrepo has elapsed or updates forced -> [help 1] i looked in pom.xml of myapp , there no mention of "tangosol" , there no parent pom figure must transitive dependency. normally , can use maven dependency plugin on command line mvn dependency:tree display transitive dependencies. however , since dependency missing, build fails , errors out instead of displaying tree. how can cause of missing transitive dependency if build failing? edit: aware of why failed, artifact is missing our local repository and central repository, question of dependencies asking it. there should

c# - Touch event on awesomium webbrowser -

by default awesomium in wpf application doesn't support touch event zoom , panning: browserleft.stylusdown += browserleft_stylusdown; browserleft.touchdown += browserleft_touchdown; i want manipulate browser myself, none of code wont occur touches, why? look @ http://wiki.awesomium.net/wpf/user-input.html "when using wpf webcontrol, webviewpresenter , not webcontrol handles user input. means handling user input related events on webcontrol, not prevent webviewpresenter handling these events , passing them native view." hope problem

javascript - Resetting a form in IE8 causes select input to fire 4 change events when value hasn't been modified -

Image
i'm working following code: <form id="myform"> <select name="myselect" id="myselect"> <option value="0">default</option> <option value="1">option 1</option> <option value="2" selected>option 2</option> <option value="3">option 3</option> </select> <input type="submit" value="go"> <input type="reset" class="reset" value="reset form"> </form> var $element = $('#myselect'); // save current value of element $element.data('oldval', $element.val()); // changes in value $element.on("change propertychange keyup input paste", function () { // if value has changed... (selects don't play nice -- if they've changed have have changed, though) if ($element.data('oldval') != $element.val() || $element.is('

java - Is it possible to set breakpoints at a specific bytecode instruction? -

i'm using jdb remotely debug java application of don't have source code. furthermore, application jars obfuscated. i can set method breakpoints but, possible set breakpoints @ specific bytecode instruction within method? idea have use disassembler javap identify interesting instructions. can jdb or other java debugger this? you need line numbers breakpoint on (something assume has been removed). can artificially add line numbers file using instrumentation , able breakpoint @ every instruction if wish.

Autocomplete in JQUERY MOBILE text input -

i searched lot on net couldnt find solution. making webapp in want 2 textbox data input user. want autocomplete feature in textbox. list of tags autocomplete available locally. tried listview want after user select option autocomplete hints, textbox should have selected value, , through object, should value of textbox used javascript/php. basic thing, i'm not able do. please me out i tried jsfiddle.net/ulxbb/48/ . problem in both listview gets same value after select in 1 listview. in order not add same value both search input, need target them using .closest() , .next() , .prev() , .find() . jquery-mobile, enhances list-view data filter in different way. demo <form> <input> </form> <ul data-role="listview"> <li> <a>text</a> </li> </ul> the form input located, on same level of ul . target input box, need use .prev('form').find('input') . check demo , new code below

java - Remove duplicate data from cursor and get data when value increase -

1 | ab | bcd | ref | ferari| ---------------------------------- 1 | ab | bcd | ref | toyota| ---------------------------------- 1 | ab | bcd | ref| audi | ---------------------------------- 1 | ab | bcd | ref| bmw | --------------------------------- 2 | bc | abc | ref | nissan| ---------------------------------- 2 | bc | abc | ref | suzki| ---------------------------------- 2 | bc | abc | ref| tata | cursor hold data table. now, want data gettopic = ab gettitle= bcd gettype = ref names = ferari toyota audi bmw i tried this do{ int current = cursor.getint(cursor.getcolumnindexorthrow("_id")); string title = cursor.getstring(cursor.getcolumnindexorthrow("title")); if(!storetitle.equalsignorecase(title) && lastid != current){ gettopic = cursor.getstring(cursor.getcolumnindexorthrow("topic")); gettitle = cursor.getstring(cursor.getcolumnindexorthrow(&q

algorithm - Find the smallest equally divisible in a range of numbers in Python, puzzle -

i'm trying solve projecteuler puzzle detailed below. current function works numbers 1 10, when try 1 20 loops forever without result. 2520 smallest number can divided each of numbers 1 10 without remainder. smallest positive number evenly divisible of numbers 1 20? def calculate(): results = dict() target = 20 num_to_test = 1 while len(results) < target: j in range(1, target+1): results[num_to_test] = true if num_to_test % j != 0: # current num_to_test failed in 1-10, move on del results[num_to_test] break num_to_test += 1 return min(results) can see issues in logic, , i'd know why working target of 10, not 20. thanks your algorithm pretty inefficient, core of problem results dictionary accumulating 1 value each integer that's evenly divisible numbers 1-20, , while loop trying keep going until has 20 such numbers. this 1 correct way im

activerecord - Rails -- get the names of all a table's columns of a certain data type? (#column_names for just float cols, for ex.) -

in rails, can this: tablename.column_names and array of table's column names strings. is there way could, in streamlined, ruby-like fashion, column_names of table numerical? or floats? or strings, etc? right now, i'm locating non-numerical column names of table i'm working , subtracting them array list of table's column names so: cols = tablename.column_names - ["name", "created_at", "location", ... ] there on hundred numerical columns best solution right now, feels hack this trick: modelclass.columns.select{ |c| c.type == :integer }.map(&:name) the column objects returned #columns contain of information present in schema, including type are, whether nullable or have default value, etc. note list include, instance, id column , xyz_id columns used reference associations. can filter out id checking #primary , xyz_id columns aren't "special" schema's point of view, might have blacklist

rest - Angularjs RESTul Resource Request -

i trying make request ....port/trimservice/fragments/?fragment_name=:fragmentname however if try make "?fragment_name" parameter, breaks. going have more requests, action change cannot leave in url portion of resource. angular.module(foo).factory('fragmentservice', ['$resource', function ($resource) { var fragmentservice = $resource('.../fragments/:action:fragmentname', {}, { 'getfragments': { method: 'get', isarray: true, params: { fragmentname: "@fragmentname", action: "?fragment_name=" } } }); return fragmentservice; } ]); as of right now, have no idea url outputting. edit: changed resource /u/akonsu had mentioned below. added controller still not working correctly. angular.module(foo).factory('fragmentservice', ['$resource', function ($resource)

php - Column Calculator -

i have following table , want know how set column total calculate sum of row. want total column calculate first_bid - second_bid . id | first bid | second bid | total 0 | 7 | 1 | (first_bid)-(second_bid) 1 | 8 | 2 | 2 | 5 | 3 | 3 | 4 | 4 | 4 | 5 | 5 | 5 | 5 | 6 | i need display user previous bids , total on page. total should in descending order also. you can calculate total when querying database. select first_bid, second_bid, (first_bid - second_bid) total table order 3 desc something along these lines

winforms - My C# form closes and returns the control to the previous form. -

i working on desktop application in c#. in code, if have load new from. have used [dot]showdialog() function object of form want load. while new form loads , works fine, after completion of function call (button press), control returns parent form automatically should have stayed on child form. can 1 please suggest doing wrong? i make wild guess, behavior typical when button pressed has property dialogresult set different none . usually happens when have made copy/paste of button prexistent button ok or cancel have property dialogresult set.

delphi - IPPeerCommon and IPPeerClient -

i'm going on cloud samples cloudexplorer , cloudupload provided embarcadero, , ippeerclient , ippeerclient units listed under uses clause. i'm trying figure out these units for/with cloud, can't seem find information on them. i tried finding units read through them, attempting select "find declaration" reveals there no ippeercommon.pas or ippeerclient.pas , , can't seem find in delphi xe3 folders. google/embarcadero searching didn't return links, makes me feel i'm missing may obvious. what using ippeercommon , ippeerclient do , whether cloud samples or in general. if there in fact code these two, would/should find it? usually tcp/http traffic in various delphi client/server components (e.g. datasnap) goes through indy implementation. connection indy not hard coded though, goes through abstraction layer. using ippeerclient , ippeerserver pulling in indy's ip implementation. unfortunately abstraction idea has been abandoned som

r - Arranging ggplot multiple objects maintaining while constant height -

Image
i'm trying split map of united states multiple windows (some of contain same state twice). i'd scales constant (so maps aren't distorted) minimize space between maps. can't use facet_wrap (due overlapping nature of regions--and anyway, facet_wrap can't have scales both fixed , have different xlims each window). suggestions on how improve spacing on results? require(data.table) require(ggplot2) require(maps) require(gridextra) all_states <- as.data.table(map_data("state")) setnames(all_states,"region","state") ##define regions overlapping states weco.states <- c("oregon","washington","california") west.states <- c("washington","montana", "idaho","utah","nevada","arizona","new mexico", "wyoming","colorado","south dakota","texas") east.states <- c(setdiff(unique(all_states$stat

c++ - std::find not using my defined == operator -

i have simple class storing in vector pointers. want use find on vector failing find object. upon debugging doesn't seem call == operator i've provided. can 'see' object in debugger know there. code below uses copy of first item in list, still fails. way can make pass use mergeline* mlt = linelist.begin(), shows me comparing objects , not using equality operator @ all. class mergeline { public: std::string linename; int startindex; double startvalue; double fidstart; int length; bool operator < (const mergeline &ml) const {return fidstart < ml.fidstart;} bool operator == (const mergeline &ml) const { return linename.compare( ml.linename) == 0;} }; class otherclass{ public: std::vector<mergeline*>linelist; std::vector<mergeline*>::iterator ll_iter; void dosomething( std::string linename){ // original version returned linelist.end() // mergeline * mlt // mlt->linename = linename; //

How to make custom Java/JavaFX console? -

it's necessary make custom console. have following code: public class console extends outputstream{ private console(resourcebundle resourcebundle) throws ioexception { fxmlloader loader = new fxmlloader(this.getclass().getresource("console.fxml"), resourcebundle); controller = loader.getcontroller(); scene scene = new scene((parent) loader.load()); stage = new stage(); stage.setscene(scene); show(); } @override public void write(int b) throws ioexception { controller.append(b); } public static console getinstance(resourcebundle resourcebundle) { if (console == null) { try { console = new console(resourcebundle); } catch (ioexception e) { e.printstacktrace(); //to change body of catch statement use file | settings | file templates. } } return console; } public void show() { stage.show(); } private static console console = null; private consolecontroller controller; priva