Posts

Showing posts from January, 2010

c++ - Implicit type conversion is not working -

class test { public: operator string() { return string{"test!"}; } }; int main() { cout << test{}; } i expecting test object implicit converted string , output, gives me error: error: cannot bind 'std::ostream {aka std::basic_ostream<char>}' lvalue 'std::basic_ostream<char>&&' this explicit conversion works: cout << string{test{}}; i got working casting const char* : class test { public: operator const char*() { return "test!"; } }; then output: cout << test{}; //yay works. i assuming cout << string implicit conversion string char * , if use casting string, not perform 2 level conversion test string char * . after directly casting const char* , works. (please correct if assumption wrong) to prove assumption right class test { public: operator string() { return string{"test!"}; } }; ostream& operator<< ...

Lua script with multi operations not working in redis -

just started playing lua scripting in redis, want execute following commands in script: set k1 foo set k2 bar tried.. > eval "redis.call('set', keys[1],'foo'); redis.call('set',keys[2],'bar'); return 1;" 1 k1 2 k2 > script load "redis.call('set', keys[1],'foo'); redis.call('set',keys[2],'bar'); return 1;" > "bb031c00b6ab2508bbf182dadd5c9bf1675cce56" > evalsha "bb031c00b6ab2508bbf182dadd5c9bf1675cce56" 1 k1 2 k2 results get k1 1) "foo" k2 (nil) why k2 not set; script and/or syntax not correct? the way call now, passes in 1 key name ( k1 ) , 2 arguments ( 2 , k2 ). i think want be eval "redis.call('set', keys[1], 'foo'); redis.call('set', keys[2],'bar'); return 1;" 2 k1 k2

Why does Kohana doesn't read my CSS? -

my website www.kipclip.com , it's running on kohana. created new rental page. it's not taking css , js files. tried find how included or if kohana has special method that. still not successful. have idea regarding this? a quick , dirty way tack on name of script(s) , style(s) in view you're implementing using regular html script , style tags , go on there. but, if don't quick , dirty , , prefer better , more concrete , if use kohana 3.2, can following. haven't tried on older or newer versions, may or may not work in them (if try port version, consult transitioning document relative version in question wish port): /** * /application/classes/controller/application.php */ abstract class controller_application extends controller_template { public function before() { parent::before(); if($this->auto_render) { //initialize empty values use other derived classes $this->template->site_name = '...

oracle11g - How do I get the console output visible in Oracle Developer IDE? -

Image
i newb oracle. used use sql plus, , use set serveroutput on see results. however, when started using oracle developer, queries run, however, not able see console or results: select * customer; i assume mean "oracle sql developer" application. if yes, in sql developer click on view option, select dbms output dbms output window (panel) should appear somewhere on screen. then, click on green plus sing in dbms-output panel, , select session want spy.

python - transport is NoneType when using UNIXClientEndpoint of Twisted -

i'm trying implement simple client twisted using datagram , named pipe. i define protocol follow: class consoleprotocol(protocol.datagramprotocol): def __init__(self, machine, console_path): self.console_path = console_path self.transport = none def datagramreceived(self, datagram, addr): self.logger.debug("datagramreceived()") # blah, doing stuff ! def sendhalt(self): self.logger.debug("sending message fifo %s", self.console_path) self.transport.write("ahaha", self.console_path) and connect unix client endpoint: console_endpoint = endpoints.unixclientendpoint(reactor, console_path) console_protocol = consoleprotocol() endpoints.connectprotocol(self.console_endpoint, self.console_protocol) but during execution of method sendhalt() , transport argument nonetype . correct way use unix client twisted ? endpoints aren't datagram protocols. need use reactor.listenunix...

mysql - Select and join in same query from same table -

i try develop mafia game. store users in table, each user able set testament. problem is: x has id1 , y has id2 sets x testament (this store id1). when x accesses status page should see stuff + testament (y). i'm newbie when occur mysql stuff, can explain me how this? in future need add more selects query, if me doing awesome :) you aliases e.g select m.name mum, c.name child people m inner join people c on c.mumid = m.id would pickout mum child irene tony from people id name mumid 1 irene null 2 tony 1

javascript - Need this function to run/rerun depending on which tab I have selected -

i have created page calls specific php page depending on tab click on. right work great on first tab fails on second because finds first 'nav' on first tab , counts not other tabs. how run on page load , when click next menu tab? window.onload=function() { var aobj=document.getelementbyid('nav').getelementsbytagname('a'); var i=aobj.length; while(i--) { aobj[i].count = i; aobj[i].onclick=function() {return showhide(this);}; showhide(aobj[i]); } }; function showhide(obj) { var adiv=document.getelementbyid('basecontent').getelementsbytagname('div'); if (typeof showhide.counter == 'undefined' ) { // create static variable showhide.counter = 0; // 1st div } adiv[showhide.counter].style.display = 'none'; // close open div adiv[obj.count].style.display = 'block'; // open requested div showhide.counter = obj.count; // save div number open return ...

Java, do variables associated with an object persist? BigInteger Example -

i'm having bit of trying figure if variables used when creating object persist in java. specifically i'm looking @ biginteger. if i'm reading code correctly looks instead of doing addition etc. on bit bit basis number broken 32bit words allows faster operation. have not been able figure out whether 32bit word representation , other variables (mag[], signum etc.) have created everytime method used on biginteger or if somehow persists in cache , remain associated particular biginteger once has been created. i guess you're looking @ code: 1054 public biginteger add(biginteger val) { 1055 int[] resultmag; 1056 if (val.signum == 0) 1057 return this; 1058 if (signum == 0) 1059 return val; 1060 if (val.signum == signum) 1061 return new biginteger(add(mag, val.mag), signum); 1062 1063 int cmp = intarraycmp(mag, val.mag); 1064 if (cmp==0) 1065 return ...

java - Add up button to PreferenceScreen -

Image
i can't figure out how go implementing button in preferencescreen . button displays caret in action bar next app icon allows navigate app's hierarchy, more info here . i have preference fragment displays when main activity opened , can button display adding line " getactionbar().setdisplayhomeasupenabled(true);": protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getactionbar().setdisplayhomeasupenabled(true); getfragmentmanager().begintransaction() .replace(android.r.id.content, new settingsfragment()) .commit(); this causes button display in preference fragment, want show button when 1 of preferencescreens opened, allowing navigation main preferencefragment . my app analogous main settings app. child screens, location access, opens main settings app has arrow. if complete application preferences screen, can make main activity preferenceactivity , sub-levels can fragments. way 'u...

css - Divs make links on image unclickable -

i trying position twitter , facebook image next portrait on website in order positioning correct have use divs. problem when add div image , link div makes image unable clicked , go link. can't rid of divs because way images positioned correctly. post jsfiddle below code. jsfiddle: http://jsfiddle.net/heyitsprodigy/rvuhv/ area of issue : <div id="facebook"><a href="http://www.facebook.com"><img src="fb.png" height="101" width="101" /></a> the problem isn't describe. issue positioning causing twitter element overlap others, makes them un-clickable. there's unfortunately not easy solution. think you're going have rethink whole css structure, including eliminating deprecated <center> tags figure 1 out. luck.

r - How to change name of row variable in a table -

it's easy change names of rows (e.g., rownames() ), that's not i'm after. consider: > newtab <- xtabs(~as.factor(letters[1:2])+letters[1:2]) > newtab letters[1:2] as.factor(letters[1:2]) b 1 0 b 0 1 i want this: upper case lower case b 1 0 b 0 1 but if try: > dimnames(newtab) <- list("lower case", "upper case") i error: error in dimnames(newtab) <- list("lower case", "upper case") : length of 'dimnames' [1] not equal array extent look @ output of str(newtab) : > str(newtab) xtabs [1:2, 1:2] 1 0 0 1 - attr(*, "dimnames")=list of 2 ..$ as.factor(letters[1:2]): chr [1:2] "a" "b" ..$ letters[1:2] : chr [1:2] "a" "b" - attr(*, "class")= chr [1:2] "xtabs" "table" - attr(*, ...

javascript - css layout get distorted when zoom in -

page adjust according screen resolution stackoverflow problem zooming , css layout distorted when zoom in. i'm new in css , first , big problem facing when zoom in or out page distorted. want page fits every resolution. please give me such solution can apply on whole page including body , footer html: <div class="wrap"> <div id="head"> <div id="head_back"> <b id="logo">logo</b> <div id="nav"> <b>2000</b> <b>2001</b> <b>2002</b> <b>2004</b> </div> </div> </div> </div> css: .wrapper{width:100%; background-color:red; overflow:auto; margin:0; padding:0;} #head { width:100%; height:100px; color:#902df3; position:relative; top:-10px; left:-7.8px; font-family:"arial black", gadget, sans-s...

IndexedDB - multiple items for an id -

i'm trying build indexeddb application uses following (one-to-many key value pair, i.e. each id has multiple images) data structure: var images = [{"id": "1", "img":["img1","img2","img3"]}, {"id": "1", "img":["img4","img5","img6"]}] my question how put , using structure. examples out there either iterate through keys or have single value associated each key can get. can open cursor on get('id') method , iterate through "img" items id? here's have tried: 1) getting specific key(one-to-one mapping): var dbget = function(id, cbget){ var transaction = db.transaction(["images"],"readonly"); var objectstore = transaction.objectstore("images"); var request = objectstore.get(id); request.onerror = function(event) {}; request.onsuccess = function(e) { ...

php - datePicker need to click twice to show the unavailable dates -

i've created code disable dates retrieved database. within getdates script retrieve dates database, return them , assign them array unavailabledates. <script> var unavailabledates; function unavailable(date) { dmy = date.getdate() + "-" + (date.getmonth() + 1) + "-" + date.getfullyear(); if ($.inarray(dmy, unavailabledates) == -1) { return [true, ""]; } else { return [false, "", "unavailable"]; } } $(document).ready(function() { $("#datepicker").datepicker({ dateformat: 'yy-mm-dd', beforeshowday: unavailable, mindate: 0, firstday: 1, // rows starts on monday changemonth: true, changeyear: true, showothermonths: true, selectothermonths: true, altfield: '#date_due', altformat: 'yy-mm-dd' }); $('#datepicker').focus(function(){ //alert($(...

.htaccess - Complex URL rewiting -

here trying achieve www.example.com/category www.example.com/category/subcategory www.example.com/category/subcategory/product www.example.com/static-page (like /about-us, /contact, /our-services) (category, subcategory, products, static-pages etc dynamic text , there permalink foreach thing in database) if see above requests, notice extending directory sturcutre 1 step each time when link clicked, e.g, first category, , when clicked on subcatogery, sent category/subcategory/ , product page anybody can me how acheive this, have tried lot achieve in vain yet. using .htaccess rewriterule c/(.*)/(.*)/ cat-details.php?permalink=$1&subcat=$2 rewriterule c/(.*)/(.*) cat-details.php?permalink=$1&subcat=$2 rewriterule news/(.*)/(.*)/ news-detail.php?news-id=$1&permalink=$2 rewriterule news/(.*)/(.*) news-detail.php?news-id=$1&permalink=$2 rewriterule d/(.*)/(.*)/(.*)/(.*)/ download-detail.php?download-id=$1category=$2&subcategory=$3&permalink=$4 rewrite...

php - Media Upload URL or URL-loop -Wordpress -

i have created custom gallery slider connect media upload gallery function that's inside post , pages creator. the problem cant seem understand how raw url-loop media upload gallery, because if add images media upload function, gives me output looks this. <div id="gallery-1" class="gallery galleryid-81 gallery-columns-9 gallery-size-thumbnail"><dl class="gallery-item"> <dt class="gallery-icon landscape"> <a href="url.com" title="jay-z+2"><img width="150" height="150" src="#" class="attachment-thumbnail" alt=""></a> </dt></dl><dl class="gallery-item"> <dt class="gallery-icon landscape"> <a href="#" title=""><img width="150" height="150" src="#" class="attachm...

Pull value from <select> with Javascript and loop -

using javascript (no jquery) project need pull value select box , compare predefined value. if match, show message box user , change select dropdown shows value compared function displayrow(preevent){ if ((preevent != 'null') && (preevent !== 0)) { //var mystring = ""; //var splitstring = mystring.split(':'); var splitstring = preevent.split(':'); for(var i, j = 0; = document.getelementbyid('thursevent').getelementsbytagname("option")[j]; j++) { var sel = document.getelementbyid('thursevent').value; var splitsel = sel.split(':'); if(splitsel[3] == splitstring[3]) { document.getelementbyid("thursevent").selectedindex = j; break; } }} <select name="thursevent" id="thursevent" onchange="displayrow(this.value);" > <option value="0"> -- please select here -- </option> <option value="645:5:227:640">t0...

javascript - Jquery Tooltipster with Validate - Warning? Non-standard document.all property was used -

i looking use jquery validate combined tooltipster in similar way example provided sparky on feb 7th '13: how display messages jquery validate plugin inside of tooltipster tooltips? the difference being validation method via script function , not form submit. want attach tooltips class instead of whole form inputs. once validation complete function calls function. it works shows following warning: non-standard document.all property used. use w3c standard document.getelementbyid() instead. which believe document.all deprecated , not existent in future browser versions. yet don't understand why code showing warning! have eliminated other possibilities of cause withing code. think either not seeing or tooltips + validation combined libraries causing warning. here js code: // initialize tooltipster on text input elements $('.valid1').tooltipster({ trigger: 'custom', onlyone: false, position: 'right' }); /...

Wordpress Custom Meta Box Not Showing -

trying add meta boxes admin , found code here make them. made changes code, applied site , meta boxes not showing @ all, on post or page types. code below: add_action('admin_init'); function admin_init() { add_meta_box("credits_meta", "mixtape info", "credits_meta", "mixtape", "normal", "low"); } function credits_meta() { global $post; $custom = get_post_custom($post->id); $dj = $custom["dj"][0]; $embed = $custom["embed code"][0]; $tracklisting = $custom["tracklisting"][0]; ?>; <label>dj:</label> <input name="dj" value="<?php echo $dj; ?>"/> <p><label>embed:</label><br /> <textarea cols="50" rows="5" name="embed code"><?php echo $embed; ?></textarea></p> <p&><label>tracklisting:</label>...

c# - Using delegates, anonymous(lambda) functions, and function pointers -

i have read little anonymous(lambda) functions , delegates. believe have dealing situation section of function could/should utilize them. not sure if assumptions correct. current code: fdosave(fgetsqlcheckempjob(), fgetsqlupdateempjob(), fgetsqlinsertempjob()); fdosave(fgetsqlcheckemppayrl(), fgetsqlupdateemppayrl(), fgetsqlinsertemppayrl()); fdosave(fgetsqlcheckeeo(), fgetsqlupdateeeo(), fgetsqlinserteeo()); fdosave(fgetsqlcheckempphone(), fgetsqlupdateempphone(), fgetsqlinsertempphone()); fgetsqlcheck...() - returns sql statement string returns count() of rows id fgetsqlupdate...() returns sql statement string update. fgetsqlinsert...() returns sql statement string insert. fdosave() either update or insert depending on value returned fgetcheck...() the fgetsql functions this: private string fgetsql...() { stringbuilder sb = new stringbuilder(); //create sql statement return sb.tostring(); } the fdosave functions looks this: private void fdosave(strin...

javascript - Need to refactor this JS, not sure where to start -

just inherited function dropdown menu , it's ugly sin, , seems pretty fragile in several browsers(mostly older versions of safari), im not sure start, suggestions appreciated. feel need break several smaller functions remove hard coded html(not sure how that) the offending code: function mini_cart_populate(){ var order; $.get('/get_current_order.json', function(data) { $('#minicart-thumbnails').html(''); order = data.order; if (order.order.line_items.length == 1) { $('#minicart_content').addclass('single'); $('.cart_pulldown').addclass('single'); $('#minicart_footer').addclass('single'); } else { $('#minicart_content').removeclass('single'); $('.cart_pulldown').removeclass('single'); $('#minicart_footer').removeclass('single'); } if (order.order.line_items.length > 0) { $('#...

javascript - How to solve _.some using _.every? -

working on programming challenge re-implement functionality of underscore.js in standard javascript. working on implementing _.some function. ( http://underscorejs.org/#some ) part i'm struggling it's asking me find way solve using _.every internally. ( http://underscorejs.org/#every ) i have finished _.every function earlier , works should. here logically wanting in sketched code: _.some = function(collection, truthstatementfunction) { return !(_every(collection, !truthstatementfunction)) } or in english, flip truth statement test condition false... , if _.every test returns true... know _.some of original truth statement false (so flip return of _.every correct return _some ). likewise if _.every returns false flip correct return of true _.some . obviously problem sketch !truthstatementfunction part. how inside iterator change internals of function flip it? doesn't seem internals of function accessible... am barking wrong tree entirely, ,...

support lib android.support.v7.widget.GridLayout causes InflateException / ClassNotFoundException with app widgets -

i'm having difficutlties use support library android.support.v7.widget.gridlayout . gives me following error: 08-09 23:49:55.746: w/appwidgethostview(132): error inflating appwidget appwidgetproviderinfo(provider=componentinfo{com.myapp.appwidget}): android.view.inflateexception: binary xml file line #33: error inflating class android.support.v7.widget.gridlayout 08-09 23:49:56.716: w/appwidgethostview(132): updateappwidget couldn't find view, using error view 08-09 23:49:56.716: w/appwidgethostview(132): android.view.inflateexception: binary xml file line #33: error inflating class android.support.v7.widget.gridlayout 08-09 23:49:56.716: w/appwidgethostview(132): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:581) 08-09 23:49:56.716: w/appwidgethostview(132): @ android.view.layoutinflater.rinflate(layoutinflater.java:623) 08-09 23:49:56.716: w/appwidgethostview(132): @ android.view.layoutinflater.inflate(layoutinflater.java:408) 08-09 23:49...

javascript - Optimizing text length of limited space -

i displaying text strings of varying characters , length in div of fixed width. i'd fit text possible in allotted space. current approach limit number of text characters in following way var n = //some number string = string.substr(0,n); the problem approach different characters have different widths while can cap on spill leaves unused space. i've tried giving containing div following css properties. div{ width:200px white-space:nowrap } but text still wraps next line down once on spills width. can me out practice way of addressing problem. you might try text-overflow from quirks mode : text-overflow comes play when: the box has overflow other visible (with overflow: visible text flows out of box) box has white-space: nowrap or similar method of constraining way text laid out. (without this, text wrap next line) style change: div{ width:200px; white-space:nowrap; overflow: hidden; text-overflow: ellipsis; } working d...

playframework 2.0 - How Openshift DIY cartridge kicks off processes? -

does diy cartridge support running 2 processes in each gear? if have 2 gears running, mean have 4 processes running @ same time? start chmod +x ${openshift_repo_dir}run/start app_command_1="${openshift_repo_dir}run/start $play_params "\ "-dhttp.port=${openshift_diy_port} "\ "-dhttp.address=${openshift_diy_ip} "\ "-dlogger.resource=${logger_resource} "\ "-dconfig.resource=application-prod.conf" echo $app_command_1 &>> $log_file nohup bash -c "${app_command_1} &>> ${log_file} 2>&1" &> /dev/null & app_command_2="${openshift_repo_dir}run/start $play_params "\ "-dhttp.port=${openshift_diy_port} "\ "-dhttp.address=${openshift_diy_ip} "\ "-dlogger.resource=${logger_resource} "\ "-dconfig.resource=application-prod.conf "\ "-dapplication.global=scheduler" echo $app_command_2 &>> $log_file nohup bash -c "${app...

Search Replace in MySQL: remove directory structure but keep filename -

i changing directory structures in drupal installation , need remove path data except file name itself. so basic structure is: +-------------+--------------+---------+-----------+-------------+----------+-------+----------------------------------------------------------------------------------+-----------------------+ | entity_type | bundle | deleted | entity_id | revision_id | language | delta | field_filename_value | field_filename_format | +-------------+--------------+---------+-----------+-------------+----------+-------+----------------------------------------------------------------------------------+-----------------------+ the filename stored in field_filename_value . here's sample record: +-------------+--------------+---------+-----------+-------------+----------+-------+----------------------------------------------------------------------------------+-----------------------+ | entity_type | b...

linker - linking library built with g 2.95.2 to object files built with gcc 4.6 -

i'm trying reuse old static library built linux gcc 2.95.2. i'm using recent compiler (gcc 4.6) 32bit ubuntu distro. library written in c++. have problems linking against functions encapsulated in classes. i guess naming of symbols has changed. http://www.qnx.com/developers/docs/6.3.2/momentics/compatibility/about.html#c++_code : gcc 2.95.3 (from 6.2.1 or 6.3) , gcc 3.3.5 use different c++ abis , have different name mangling. result, can't link c++ binaries (objects, executables, libraries) built gcc 2.95.3 binaries built gcc 3.3.5. the error output of ld is: undefined reference `foo1::bar()' (class foo1; member bar) with tool mn symbols read out. matching symbol named in different way: bar__4foo1 question: there way rename symbols in library file? or can force ld accept old naming format? i guess naming of symbols has changed. correct. what missing naming has changed a reason , namely code produced g++ 2.95 , g++ 3.3 ...

android - Receive a broadcast AFTER user click on OK button AFTER uninstall was completed -

i placed receiver tags in androidmanifest.xml : <receiver android:name="my.package.mybroadcastreceiver" > <intent-filter> <category android:name="android.intent.category.default" /> <action android:name="android.intent.action.package_removed" /> <data android:scheme="package" /> </intent-filter> </receiver> and implemented broadcastreceiver subclass: public class mybroadcastreceiver extends broadcastreceiver { @override public void onreceive( final context context, final intent intent ) { log.w( "received!!!!!!!" ); } } this works fine!!! but... onreceive method called after uninstall completed before users press ok @ confirmation activity showed native system. i wanna, if exists, receive broadcast after user press ok . thanks! i made workaround , works far. the activity calling uninstall intent flagged that:...

android - SQLiteException trying to load a contact photo with Picasso -

i'm getting following error on devices when trying load contact photos in cursoradapter : java.lang.runtimeexception: unexpected exception occurred @ com.squareup.picasso.request$1.void run()(unknown source) @ android.os.handler.handlecallback(handler.java:605) @ android.os.handler.dispatchmessage(handler.java:92) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:4514) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:511) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:790) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:557) @ dalvik.system.nativestart.main(native method) caused by: android.database.sqlite.sqliteexception: near "and": syntax error: , while compiling: select distinct data15 view_data_restricted data ( , _id=photo_id1 , _id=photo_id , contact_id=?) @ android.database.databaseutils.readexceptionfromparcel(databaseuti...

HTML5 history API to reduce server requests -

i trying develop search filter , making use of html5 history api reduce number of requests sent server. if user checks checkbox apply filter saving data in history state, when user unchecks able load data history rather fetching again server. when user checks or unchecks filter changing window url match filter set, instance if user tries filter car brands of category change url 'cars?filter-brand[]=1'. but when mutiple filters applied have no way of figuring out whether load data server or load history. at moment using following code. pushstring variable new query string created. var = [],forward = []; if(back[back.length-1] === decodeuri(pushstring)){ //check last val against next url created back.pop(); forward.push(currentlocation); history.back(); return true; }else if(forward[forward.length-1] === decodeuri(pushstring)){ forward.pop(); back.push(current...

javascript - Button value is empty when use jquery selector -

i trying select value selected button following : html code : <div class="span3"> <div>debit/credit</div> <div class="btn-group" data-toggle="buttons-radio" id="investadjust-debitcredit-button"> <button name="debitcredit" type="button" id="credit-button" class="btn active" value="credit" >credit</button> <button name="debitcredit" type="button" id="debi-button" class="btn" value="debit" >debit</button> </div> </div> javascript code : $("#investadjust-debitcredit-button>.active").val() but empty when printed above line after selecting 1 button. what reason. as neo said need place code in document ready function , use class name of button without spaces or can add underscore bet...

c# - Dynamicaly merging cells and hiding rows in gridview and exporting it to excel -

i m hiding columns while exporting griddata excel checking/unchecking checkboxes.the code have used follows protected void btnpacklist_click(object sender, eventargs e) { string printtype = ""; string vrnumber = ""; string userid = ""; foreach (gridviewrow row in gridview2.rows) { checkbox chkbxheader = gridview2.headerrow.findcontrol("chkbxheader") checkbox; checkbox chkbxselect = row.findcontrol("chkbxselect") checkbox; label vrno = row.findcontrol("vrno") label; if (chkbxheader.checked == true) { printtype = "all"; userid = ddlcustomer.selectedvalue; } else if (chkbxselect.checked == true) { printtype = "selected"; if (vrnumber == "") { vrnumber = "'" + vrno.text + "'"; } else ...

jquery - Custom overlay in fancybox -

i show overlay content. cannot touch title here, used. basically, i've got gallery of images not want call iframe. with, inline i'll have discreetly provide height , width (i guess), stop images resizing accordingly. i guess, clear on requirement. thanks, appreciated. if understood question, create "custom overlay" content (hidden) inline html : <div id="mydata"> <div class="dataoverlay"></div> <div class="datatext">lorem ipsum blah, blah, blah</div> </div> with style position : #mydata { position: absolute; width: 100%; height: 100%; display: none; top: 0; left: 0; } #mydata .dataoverlay { position: absolute; top: 0; left: 0; background-color: #000; opacity: 0.4; width: 100%; height: 100%; z-index: 12; } #mydata .datatext { position: absolute; top: 0; left: 0; color: #fff; font-size: 18px; ...

theory - Continuous version of rod cutting -

this might not question forum, attempt extend idea computer science.. dynamic programming based solution of rod cutting problem (given rod of integral length , array of prices each integral value of length, find optimal cuts maximize profit). asked question implementation of rod cutting problem here yesterday. thinking made me wonder.. if not constrained cut rod @ integral values, cut liked (fractional lengths possible). further, lets instead of table of prices corresponding integral lengths, given continuous (monotonically increasing, tapering) function represents value of rod @ different lengths. example, rod of length 1, value function might given cdf of beta distribution. now, want find number of cuts should make , @ values optimize total value. has 1 heard of such problem (i couldn't find thing online)?

php - Any difference between returning False or True first? -

i have following function. can run test if true, or else false or vice versa shown. $fname=$_post['fname']; $lname=$_post['lname']; function namecheck ($fname,$lname) { $names= array ($fname,$lname); $regexp ="/^[a-za-z]+$/"; //filter through names ($i=0; $i<2; $i++) if (! preg_match($regexp, $names[$i])) { return false; } return true; } (alternate version): for ($i=0; $i<2; $i++) if (preg_match($regexp, $names[$i])) { return true; } return false; which better way write this, both in terms of efficiency , coding practices? or there no difference? it may not issue small array this, wondering effect have on larger , more complex program. the difference both loops checking different results. the 1 st loop checking whether $regexp matches elements of array - in case, returns false match fails , if return statement after loop reached, means elements match. honest,...

iphone - Correct way to asynchronously load tableview cell data -

i try asynchronously set uitableviewcell 'description' field, due reusing view cells have problems when fast scroll tableview - tableview cells refreshed several times. code below. what's wrong here? - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath; { [timeexecutiontracker starttrackingwithname:@"cellforrowatindexpath"]; static nsstring *cellidentifier = @"messagecell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } ctcoremessage *message = [_searchresults objectatindex:indexpath.row]; uilabel *fromlabel = (uilabel *)[cell viewwithtag:101]; uilabel *datelabel = (uilabel *)[cell viewwithtag:102]; uilabel *subjectlabel = (uilabel *)...

java - Pros and Cons of Clojure http client libraries -

i trying write http file downloader in clojure, , in one of other questions , commented using dedicated http client library better coding clojure's , java's own api. did research , found some, couldn't figure out features, pros , cons of each. if 1 can explain how different , 1 match project, appreciated. :-d libraries in java, , corresponding clojure wrappers: apache httpclient , clojure wrapper clj-http apache httpasyncclient , couldn't find clojure wrapper. netty , clojure "wrapper" aleph , guess? async http client , clojure wrapper http.async.client last not least, clojure library: http-kit i can compare http-kit , clj-http. clj-http: simple api http client only a wrapper apache httpcomponents http-kit: designed async http client , server, more powerful client api modeled after clj-http adds more abstractions cognitive load higher if care dependencies, http-kit may better choice because standalone library no...

entity framework - Multiple contexts and MergeOption -

setting mergeoption on entityset overrides caching behavior of subsequent queries on entityset -- that's clear. however, seems setting mergeoption on entityset 1 context affects caching behavior of queries on other contexts... example: using (var db1 = new context()) { db1.table.mergeoption = mergeoption.notrack; using (var db2 = new context()) { var record = db2.table.firstordefault(); // record *detached* } } the way caching behavior on db2 convert query objectquery , change query's mergeoption. use following handy extension method: public static objectresult<t> withmergeoption<t> (this iqueryable<t> query, mergeoption mergeoption) { return (query objectquery<t>).execute(mergeoption); } is expected behavior entityset's mergeoption? behaves if overrides static default instead of default on context instance.

How to store user's preferred currency format in Rails application? -

i want users of international, multilingual rails app able set own currency , currency format. right now, using translation files achieve this: de: currency: format: format: "%n %u" unit: "€" separator: "," delimiter: "." however, not flexible enough. e.g. if user wants use euro wants € symbol appear before amount? so best way store user's currency formatting preferences , use throughout application? i figured store user's preferences in database this: user.preferences.format = "%n %u" user.preferences.unit = "€" user.preferences.separator = "," user.preferences.delimiter = "." user.preferences.save and then, in view: number_to_currency(123.50, unit: user.preferences.unit, separator: user.preferences.separator, delimiter: user.preferences.delimiter, format: user.preferences.format) is common rails practice? might better approach? thanks he...

java - File uploaded in postgres db -

i'm new of vaadin , i'm developing first application spring , vaadin. now i'm trying save image inside database. followed description of upload component on vaadin-book ( upload component ) what have change if want store in database? can give me example? the upload component writes received data java.io.outputstream have plenty of freedom in how can process upload content if want store large object, can write directly stream comes in. see large object support . if want store bytea in row, must accumulate in memory pass parameterized query setobject(parameterindex, mydatabuffer, types.blob) . consume several times object's size in memory, bytea suited smaller data.

c# - Reading strings that are in CSV format -

i writing configuration file parser c# application. configuration file text file contains custom-format strings plus csv strings. reading string array of course simple, if want read string if in csv format? know there plenty of libraries read csv files, file hybrid essentially. there appear lots of options, don't want re-invent wheel on 1 thought worth shout out stackoverflow. update: i'm trying avoid having 2 configuration files, 1 custom-format text , other exclusively csv. i'll if have i'd prefer single point of configuration. string.split looking best candidate @ moment. cheers

c# - Add to MSSQL from PDF form -

i have pdf form used purpose of creating inspection reports. using c# winforms gui accept data users, insert data mssql db, , populate said pdf form. latter achieved using itextsharp library. i have been receiving requests process reversed, whereby, users enter data form, more visually appealing interface, then, through means of pdf button or similar, take data form fields in background, , save db. flow be: users populate pdf form > button clicked > data saved db > pdf form saved local machine. can recommend way of acheiving this? if there way of making pdf buttons invoke c# scripts, ideal, have button save form, , invoke script passing form filepath parameter. thanks in advance. my preference use web interface or, highcore mentioned, wpf. acrobat allow database interface pdf forms. here @ adobe's website . other option pdfs support javascript use post data web service.

objective c - How do you assign characterAtIndex to NSString variable? -

i've looked @ several posts answer question keep getting errors. i have nsstring holds 2 characters... mystring = @"abc"; all want assign first character in mystring nsstring variable... nsstring *firstchar; firstchar = [mystring characteratindex:0]; i error when this: incompatible integer pointer conversion assigning 'unichar *' (aka 'unsigned short *') 'unichar' (aka 'unsigned short') what doing wrong? nsstring 's characteratindex: returns unichar , not string, can't assign string. need create string first: nsstring *mystring = @"abc"; unichar firstchar = [mystring characteratindex:0]; nsstring *string = [nsstring stringwithcharacters:&firstchar length:1]; of course, darkdust says, can use substringwithrange: string subrange of string: [mystring substringwithrange:nsmakerange(0, 1)]; // first character [mystring substringwithrange:nsmakerange(1, 2)]; // second , third characters...

How do I display a list of heavily formatted text fragments in Android? -

i developing android app community forum , struggling how display conversations. 1 page consists of 30 posts, bound per api. posts contain text usual formatting (strong, underline, etc.), may contain tables, blockquotes , other blocklike elements. elements can nested, e.g., <table> block may surrounded <strong> tags. each post consists of header static layout , non-formatted text. the approach used far rendering whole conversation html in webview . easy, since can use css , javascript customize , straightforward implement. however, method has drawbacks: webview s heavy. when animated gifs or large images contained, scrolling , interaction becomes less smooth on fast phones. interaction app limited; more difficult scroll specific position when view rendered; mostly, because must handled via javascript , 1 never knows render times etc. buttons, long touches, link clicks etc. must handled via javascript, which, different touch events, kind of cumbersome. now th...

matlab figure - Crammed text when printing to EPS with latex interpreter -

i trying save figures eps files using latex interpreter, , command line (matlab -nojvm). the resulting title , label text crammed , letters overlap (screenshot here: http://i.imgur.com/0w9v76j.png ). sample script replicate behavior: hfig = figure(1); set(hfig,'visible','off') x = 0:0.1:1; plot(x,x) set(gca,'fontsize',12) axis([0 1 -1 1]); xlabel('x test test','interpreter','latex'); ylabel('sin(x) blah blah','interpreter','latex'); titletextdisp = ['testing long title name']; tfig = title(titletextdisp); set(tfig, 'interpreter','latex'); %plotticklatex2d('xlabeldy',0.02); set(gcf,'paperpositionmode','auto') set(hfig, 'position', [0 0 700 500]) figname = ['test.eps']; print(gcf,'-dpsc2','-painters',figname); the visibility of figure not affect result. i'd appreciate hints.

ember.js - How to do implement this relationship with ember-data -

i'm working on ember.js project, backed rails 4 api. now i've relationship i'm not sure how implement ember-data. i have 2 models: user , event user can create events, there 1-n relationship between creator , event user can attend events, there m-n relationship between attendees , events the creator-event relationship returned api creator_id on events , event_ids on creator. the attendees-events relationship returned api attendee_ids on events , attended_event_ids on attendees. now, ember-data supports many-to-many relation adding hasmany relations on both ends of relation. # app.user events: ds.hasmany('app.event') attended_events: ds.hasmany('app.event') # app.event creator: ds.belongsto('app.user') attendees: ds.hasmany('app.user') my problem is, how tell ember-data attendees related attended_events , creator relates events? ok, never mind, figured out myself, seem work: # app.user events: ds.hasmany('a...