Posts

Showing posts from March, 2010

PHP: preg_match_all - anyway to capture offset and use the PREG_SET_ORDER flag? -

i need part out matches in more intuitive manner preg_set_order gives while still getting offset of each match. there anyways accomplish this? i need capture kind of tag , not want post process capture. lookbehind mess. this tags , there offset pops out 3-dim array excessive: preg_match_all('|(?<=<)[\/a-za-z]+|',$file,$matches,preg_offset_capture); this yields cleaner result dont know offset tags located: preg_match_all('|<(\/*)([a-za-z]+)[^>]*>|',$file,$matches,preg_set_order) so need combination of two: preg_match_all('|<(\/*)([a-za-z]+)[^>]*>|',$file,$matches,preg_set_order,preg_offset_capture) not sure you're looking for, appears you're trying use preg_set_order while still getting offsets? if so, pass both flags preg_match_all: preg_match_all($find, $string, $matches, preg_set_order|preg_offset_capture); var_dump($matches) numerical flags such these can combined using bit or operator | (vertic...

database - Django south datamigrations not running post saves -

i using django south data-migrations update data in new tables after schema-migrations create new tables. have written post-save methods on existing tables update data on newly created tables. this, using data-migrations , in forward method, saving existing table rows in post-saves, new tables data populated. however, post saves dont run after running data migrations. 1 way call post-save function directly forward method in datamigrations. south documentations recommends should use orm objects freeze state. in post-save methods, using these models normally. way copy same code in migration way, everytime make changes in post-save method, need update code in datamigration forward method. what best way achieve this? migration files python modules. can import code other parts of project hence reusing logic. that slippery slope because: lets have migration migrates database state x state y (and backwards). lets migration reuses code foo.py . after time need change db s...

c - Does there exist an LR(k) grammar with no LL(1) equivalent -

i haven't been able find answer yet. there grammars context free , non-ambiguous can't converted ll(1)? i found 1 production couldn't figure out how convert ll(1): parameter-type-list production in c99: parameter-type-list: parameter-list parameter-list , ... is example of lr(k) grammar doesn't have ll(1) equivalent or doing wrong? edit: copied wrong name, meant copy parameter-declaration: parameter-declaration: declaration-specifiers declarator declaration-specifiers abstract-declarator(opt) the problem declarator , abstract declarator both having ( in first set, being left recursive. in general, lr(k) grammars more powerful ll(k) . means there languages lr(k) parser, not ll(k) . one of examples language defined grammar: s -> s s -> p p -> p b p -> \epsilon or, in other words, string of a 's, followed same or less number of b 's. follows fact ll(k) parser must make decision every a encountered - p...

c# - VB.Net Inline comments -

being c# developer, surprised find couldn't create inline comments within array declaration. in test case want simulate 2 byte array packets coming through together: dim buffer byte() = { &hf5, &h5, &h53, ... many more bytes &h1, &h2, &hce, &hf5, 'new packet starts here... doesn't work :( &h5, &h53, ... many more bytes &h1, &h2, &h1a } surely i'm missing something, possible place inline comments within array declaration? if not, there decent work around? need split array 2 , join them together? thanks in advance. no not possible. but, found out yourself, in future version - visual basic 14 (visual studio 2015) possible new language features in visual basic 14 for current version can create named variable , use in array declaration dim newpacketstarts byte = &hf5 if have lot of hardcoded values - create constants describable names const star...

ios - Swift - NSPredicate -

is there cleaner way without having specify searchtext twice? or best way? let searchpredicate = nspredicate(format: "self.firstname contains[c] %@ or self.lastname contains[c] %@", argumentarray: [searchtext, searchtext]) in case, think va_arg prototype cleaner array one: let searchpredicate2 = nspredicate(format: "self.firstname contains[c] %@ or self.lastname contains[c] %@", searchtext, searchtext) but both case have same result, it's you. note have third way create predicate: using dictionary. take @ documentation .

python 3.x - returning a replaced field in a list of namedtuples in a namedtuple -

i have restaurant , dish type namedtuple defined below: restaurant = namedtuple('restaurant', 'name cuisine phone menu') dish = namedtuple('dish', 'name price calories') r1 = restaurant('thai dishes', 'thai', '334-4433', [dish('mee krob', 12.50, 500), dish('larb gai', 11.00, 450)]) i need change price of dish 2.50. have following code: def restaurant_raise_prices(rest): result = [] item in rest: dish in item.menu: dish = dish._replace(price = dish.price + 2.50) result.append(item) return result it replaces price field , returns dish namedtuple: [dish(name='mee krob', price=15.0, calories=500), dish(name='larb gai', price=13.5, calories=450)] how can change code add restaurant well? but returns dish. if wanted entire restaurant too? how can make change output is: restaurant('thai dishes', 'thai...

php - header('Location: '.$newurl) in not working in my Magento -

in magento have 2 store, want integrate example payment gateway in magento. in magento have logic if transaction status success go redirect success page else redirect failure page. but pg side don't have type of logic wants 1 url, when request site redirect url, decided this. just created 1 .php file in root folder (root folder/example/redirect.php). the pg redirecting customers url along pg posting response also. based on pg response written code in redirect.php please find code below. <?php header("pragma: no-cache"); header("cache-control: no-cache"); header("expires: 0"); $magefilename = '../app/mage.php'; require_once $magefilename; mage::app(); if (empty($_request['orderid'])) { $_order_orig = mage::getmodel('sales/order')->loadbyincrementid($_request['orderid']); $store_id = $_order_orig->getstoreid(); ...

ruby - How does lambda function works in rails with an example from paperclip gem -

i had problem paperclip gem default_url doesn't load after fingerprinted in production environment, code this: class user # attachments paperclip - profile pic has_attached_file :profilepic_attachment, :styles => { thumb: '100x100#', square: '500x500#' }, :default_url => actioncontroller::base.helpers.asset_path("missing/default_user.png"), :preserve_files => true validates_attachment_content_type :profilepic_attachment, content_type: /\aimage\/.*\z/ end note when rails c in production , print out actioncontroller::base.helpers.asset_path("missing/default_user.png") . fingerprinted version (correct version) printed out. default_user-fb34158daae99f297ad672c43bb1a4d3917d8e272b5f2254aa055392aa2faa94.png . however, when inspect browser, original /assets/missing/default_user.png appeared. i strugg...

c# - Remove Default icons from title bar in winForms -

how remove default icons(network, battery, volume)from right corner of title bar in compact framework/c# ? those icons not part of or application. akin system tray in windows. cannot remove them. option make form borderless , full screen, cover them up, , if still want "title bar" effect, paint 1 in manually on form.

javascript - providing a blank option in the combobox sapui5 -

i trying populate dropdownbox in sapui5 json new sap.ui.commons.dropdownbox(this.createid('inpexpensetype'), { selectedkey: '{expensetype/id}', editable: '{/caneditpayment}', required: "{/caneditpayment}", displaysecondaryvalues: true, items: { path: 'parameters>/benefits', template: new sap.ui.core.listitem(this.createid('liexpensetype'), { key: '{parameters>id}', text: '{parameters>name}', additionaltext: '{parameters>code}' }) }, layoutdata: n...

database - Selecting a value of a combo box if the user selects a value in another combo box -

i have ms access 2010 form has combo box called cbxclass , combo box called cbxcourse + 1 called cbxinstitute. right form works selecting institute , values in cbxcourse change according institute. cbxclass values inside combo box change according institute. cbxclass values change according class belong institute, problem that, want user able select class cbxclass , once event happens , selected value of cbxcourse change according course class enrolled in.... class can enrolled 1 course, there 1 choice, automatically select once user choose class drop down menu. i'm quite new ms access, work on else , don't have experience when configuring macros. create onlostfocus event combo box cbxclass , add cbxcourse.value = findcourse(cbxclass.value) . findcourse function returns corresponding course given class, know course belongs given class. , called everytime you'll leave cbxclass combo box. use onchange event well, executed everytime you'll change in cbxc...

network programming - Send captured TCP packets through Wireshark as PDML to remote system -

i have 'sender.exe' , 'receiver.exe'. sender send images receiver. have captured packets sent sender receiver through wireshark , exported them pdml format. now, have fuzz captured packets , send receiver system. first step, need know following: there way send packets captured in pdml format or xml format? in order that, have 1) hope every single byte of packet represented field value= , 2) write own code take value= s of fields , put them binary packet (i.e., undo conversion of raw packet data pdml) , send packet. there nothing in wireshark you.

angularjs - ui-router navigate to another state onEnter -

i have wizard flow collects informationa states["wizard"] = { abstract: true, url: "^/wizard", controller: "wizardcontroller", templateurl: "wizard.html" }; states["wizard.input"] = { url: "^/input", views: { "": { controller: "wizardcontroller", templateurl: "form.html" } } } states["wizard.completed"] = { templateurl: "completed.html" }; and wizard flow b that's similar structure that's collecting informationb. what want when user navigates /wizard, checks if informationb filled, if not, navigate fill informationb first , navigate /wizard continue wizarda. what's best way redirection when user navigates /wizard , best way return /wizard when wizardb finishes? for return pass param in url , in wizardb control...

java - How can read message from rabbit and return boolean value? -

i have built code sender message client java , c# using rabbit. have this: public boolean isnaoconnect() { bool isconnect = false; string azione = "checknao.java:&&{"; //immetto parametri di tipo stringa azione += "}&&{"; //parametri di tipo int azione += "}&&"; var messagebody = encoding.utf8.getbytes(azione); channel.basicpublish("", "astro", null, messagebody); var consumer = new eventingbasicconsumer(channelresponse); consumer.received += (model, ea) => { var body = ea.body; var message = encoding.utf8.getstring(body); if (message != null && message.equals("true")) isconnect= true; }; channelresponse.basicconsume(queue: "astro_response", noack: true, consumer: consumer); console.readline(); return isconnect; } if client java send message true, method isnaoconnect should return true else f...

javascript - select2 overwrites e.preventDefault() -

i've wrote script uses bunch of data , building grid able move through arrowkeys , tab. while testing in seperate file works fine. after adding website script works pretty in chrome, opera, safari , ie. in firefox focus jumps out of grid , went adressbar. using same data in testfile, there no error this. what reason why not work in firefox? got no errors in firebug. its file more 2500 lines...here part navigation tab starts: $(document).keydown(function (e) { switch (e.keycode) { case 9: if (editing == true) { e.preventdefault(); var direction = "right"; if (e.shiftkey) { direction = "left"; } root.gridsave(); root.movemark(direction); var checker = true; ...

Regex: How to parse images not only the <img> tags -

for last whole week have been busting head find regular expression parse images in html source file. know there many out there parse tags. tricky part images in javascript , have weird long formats such : http://pinterest.com/pin/create/button/?url=http://www.designscene.net/2015/07/binx-walton-josephine-le-tutour-vera-wang.html&amp;media=http://www.designscene.net/wp-content/uploads/2015/07/vera-wang-fall-winter-2015-patrick-demarchelier-03-620x806.jpg&amp;description=binx walton , josephine le tutour vera wang fw15 i have tried negative heads , booleans not find solution. please give me perspective. well said there many ways , honest there not regex solution parse html files out there.. have tried in past well. me below worked best : /(?:.(?!http|\,))+(\.jpg|\.png) a bit of explanation: /......(.jpg|.png) starts first slash finds until finds image ext . char between slash , ext (?:.(?!http|\,))+ omit if there http or , in (works charm example link hav...

virtualbox - vagrant synced folder - network error on read -

im having issues synced folders in vagrant. have windows 7 host, using virtual box have server 2012 guest. shares mount , can navigate to directory on guest when dir network error. can browse directory on guest. ideas? [localhost]: ps c:\users\administrator\documents> dir .\guest_share dir : network path not found. + categoryinfo : readerror: (c:\users\admini...nts\guest_share:string) [get-childitem], ioexception + fullyqualifiederrorid : dirioerror,microsoft.powershell.commands.getchilditemcommand creating file fails identical error. have enabled credssp on host , guest. identical behavior default syned folder custom one. here excerpt vagrantfile: config.vm.synced_folder "share/", "c:/users/administrator/documents/guest_share"

python - How to filter shift +/- 1 day in Pandas? -

hi guys suppose have timeseries data. how filter data occurs in 1 days different? suppose data date name 2015-04-03 2015-04-04 2015-04-05 2015-04-03 b what want like df[df.shift(1).contains(df.name) or df.shift(-1).contains(df.name)] that give me date name 2015-04-03 2015-04-04 2015-04-05 how in pandas? you want wrap conditions in parentheses , use bitwise | instead of or : in [83]: df[(df['name'].shift(1) == df['name']) | (df['name'].shift(-1) == df['name']) ] out[83]: date name 0 2015-04-03 1 2015-04-04 2 2015-04-05

ios - UIScrollView automatically scrolls to next subview horizontally then bounces somewhere else -

uiscrollview has several uilabel subviews, set scroll horizontally (think instagram filters scrolling view). can scroll uiscrollsubview, act upon tapping on uilabel subview. next thing achieve programmatically scroll invisible uilabel subview, when users selects last visible subview on right (similar how instagram filters scroll out of visible area when user selects last visible filter). when user touches last visible uilabel subview, execute [_scrollview setcontentoffset:cgpointmake(64, 0) animated:yes]; where 64 width of every uilabel subview of scrollview. this works fine on first selection event of last visible subview. once scrollview scrolled reveal desired subview on right side of selected one, , select newly revealed subview, scrollview correctly scrolls left revealing next invisible subview, jumps (to right) 2 positions (128). desired behaviour scroll left when last visible subview on right selected (right happens on first selection). any suggestions appreciated....

javascript - Ajax function doesn't execute when any of the input fields are not supplied in django -

i have below ajax function, working fine when input values fields, doesn't work when not supply value of 3 fields (pname,psection, , rinput-json) <script type="text/javascript"> function saveprof() { $('.spinner').show(); $.ajax({ type: "post", url: "saveprof", enctype: 'multipart/form-data', async: true, data: { 'pname_aj': $('#pname').val(), 'psection_aj': $('#psection').val(), 'rinput_aj' : json.stringify(fun()), 'csrfmiddlewaretoken': $("input[name=csrfmiddlewaretoken]").val() }, success: function (data, textstatus, jqxhr) { $('#message').html(data); window.location.href = 'myprofile'; ...

sql server - How to return Sql error in Java SpringRestful WebService? -

how handle error sql error in java springrestful webservice? read arround internet can return httprequest error. if want return error sql? here : @requestmapping(value = "/dynamicurl/{sp}/**", method = requestmethod.get,headers="accept=application/json") public string dynamicurl(@pathvariable("sp") string sp, httpservletrequest request) throws parseexception { string strparam="exec myglorystoredprocedure"; try { userservice.dynamicurl(strparam); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); err = e.getmessage(); throw new runtimeexception(e); } return err; } when trying generate error entering wrong stored procedure name, should give me "could not find stored procedure 'myglorystoredprocedure'." in console didn't return anything, when execute webservice, via web browser....

Main Javascript dont process in template loaded with directive in AngularJs -

i'm trying javascript function: $(".panel-header .panel-toggle").click(function (event) { event.preventdefault(); $(this).toggleclass("closed").parents(".panel:first").find(".panel-content").slidetoggle(); }); to work on html i've loaded through directive .directive('ngaddslide', function() { return { restrict:'e', scope: {'val': '@'}, templateurl:'template/portlet.html', } }); and compile in controler var html = "<ngaddslide></ngaddslide>"; var target = $('#element'); target.append(html); html = $compile($('#element'))($scope) the problem is, tho javascript works in original dom , template loads in page, js not apply new html. is there way make javascript apply added html? thx

css - IE not get responsive screen when open page that deploy on server tomcat, but it work fine when run on eclipse project with IE before deploy -

i create application using spring mvc project. when run project in eclipse , try open page on ie work fine, responsive screen work fine when deploy on server , open page in ie responsive not working. my css /* small devices (tablets, 767px , down) */ @media and( max-width : 400px ) { @-webkit-viewport { width: device-width; } @-moz-viewport { width: device-width; } @-ms-viewport { width: device-width; } @-o-viewport { width: device-width; } @viewport { width: device-width; } .item-thumb { height:70vmin; } .item-thumb img { height: 100%; } #logo img { width: 65%; } #order-btn { width: 70%; margin: 0 auto; } } /* small devices (tablets, 767px , down) */ @media , ( min-width : 401px ) { @-webkit-viewport { width: device-width; } @-moz-viewport { width: device-width; } @-ms-viewport { width: device-width; } @-o-viewport { width: device-width; } @viewp...

dynamic programming - Counting change in Haskell -

i came across following solution dp problem of counting change : count' :: int -> [int] -> int count' cents coins = aux coins !! cents aux = foldr addcoin (1:repeat 0) addcoin c oldlist = newlist newlist = (take c oldlist) ++ zipwith (+) newlist (drop c oldlist) it ran faster naive top-down recursive solution, , i'm still trying understand it. i given list of coins, aux computes every solution positive integers. solution amount index list @ position. i'm less clear on addcoin , though. somehow uses value of each coin draw elements list of coins? i'm struggling find intuitive meaning it. the fold in aux ties brain in knots. why 1:repeat 0 initial value? represent? it's direct translation of imperative dp algorithm problem, looks (in python): def count(cents, coins): solutions = [1] + [0]*cents # [1, 0, 0, 0, ... 0] coin in coins: in range(coin, cents + 1): solutions[i] += ...

java - netbeans warning: Method is declared final -

i trying rid of warnings in code, , tonight noticed warning (not compiler warning) netbeans. take code: class { public void method1() { return null; } public final void method2() { return null; } } on method2() netbeans says: method method2 declared final but what's wrong that? in implementation of class, works expected: class suba extends { @override public void method1() { return super.method1(); } @override public void method2() { // <---- throws error return super.method2(); } } so why netbeans complaining? note: know can turn off warning (and know how), know logic behind (if any). in netbeans 8+: goto tools --> options click on editor top button goto hints tab. make sure java selected in language combo box. in left tree view, expand class structure . check if final method checked. your warning happening because above configuration enabled, should not ...

openerp - where can i find openerp_report_designer plugin? -

i found plugin folder inside base_report_designer when added apache open office doesn't show signs of working. please can guide me on tried looking @ resources or steps mentioned on over various websites failed so. just can download base_report_designer module link click download you should add module in openerp 7.0 addons directory , install in system.this module working fine side. reference link installation guideline : youtube : https://www.youtube.com/watch?v=wok6spawzmg other web references : http://www.serpentcs.com/wp-content/uploads/2014/08/openerp-report-designer.pdf i hope answer may helpful :)

sql - Fetch the data from database using the same column of same table using hash map -

i want fetch data database using hashmap. example- table name menu restaurant_id item_name price category 1101 burger 59 1101 pizza 101 1101 colddrink 40 b 1101 bread 30 b output must this category a item_name price burger 59 pizza 101 category b item_name price colddrink 40 bread 30 i want fetch data table menu jsp page. please me . have tried many did'nt output need. i've used arraylist here give same output want code: step 1: categories table_name_menu table arraylist public static arraylist<characters> getcategories(connection con) throws sqlexception { statement stmt = null; string query = "select distinct(category) table_name_menu order category asc"; stmt = con.createstatement(); resultset rs = stmt.executequery(query); arraylist<character> categories = new arraylist<cha...

mvvm - Binding from within a ResourceDictionary in a Catel WPF UserControl -

i converting of views , view models of our wpf application on catel, proof-of-concept. one of user controls doesn't seem correctly binding view model @ runtime. think understand why is, feedback on best remedy is. the code i have simple view model observablecollection : persontable.xaml key things note: i'm using collectionviewsource wraps main collection datagrid binds to. can keep grid auto-sorted. <catel:usercontrol x:class="myapp.persontable" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:scm="clr-namespace:system.componentmodel;assembly=windowsbase" xmlns:catel="http://catel.codeplex.com" ...

ember.js - How can I peek the contents of a hasMany relationship? -

i have model, node : app.node = ds.model.extend({ parents: ds.hasmany('node', { inverse: null }) }); let's server sending partial tree: { id: "a", parents: [ "c" ] } { id: "b", parents: [ "c", "d" ] } { id: "c", parents: [ "e" ] } i want render so: a ---- c / b ---/ however, when call b.get('parents') , message stating: uncaught error: assertion failed: looked 'parents' relationship on 'node' id b of associated records not loaded. either make sure loaded parent record, or specify relationship async ( ds.hasmany({ async: true }) ) neither of desirable me. want loaded records in graph. i may want render well: a ---- c--? / b ---/--? representing unimportant parents ui element. is there way peek loaded records in relationship? great question. currently, ember data falls short on such use cases. there an answer question it...

how to retrieve json using models in gson android? -

i'have json array below : { "otg": [ { "id": "1", "name": "forum otg nasional", "description": "otg description", "banner": "", "date": "june, 18th 2015", "time": "08:06" } ] } and want retrieve json using models using gson, models class : import java.util.arraylist; import java.util.list; import com.google.gson.annotations.expose; public class modelb { @expose private list<otg> otg = new arraylist<otg>(); public list<otg> getotg() { return otg; } public void setotg(list<otg> otg) { this.otg = otg; } public class otg { @expose private string id; @expose private string name; @expose private string description; @expose private string banner; @expose ...

Can do without spark-submit in java? -

i told there spark cluster running on "remote-host-num1:7077" multiple nodes on "remote-host-num2:7077" "remote-host-num3:7077". if write program following: sparkconf conf = new sparkconf().setappname("org.sparkexample.testcount").setmaster("spark://remote-host-num1:7077"); javasparkcontext sc = new javasparkcontext(conf); and create javardd "myrdd" sc.textfile, , perform operation counts "myrdd.count()". operation taking advantage of machines in remote cluster? i want make sure don't want use spark-submit "myjarfile" if can avoid it. if have to, should doing? if have use spark-submit take advantage of distributed nature of spark across multiple machines, there way programatically in java? yes, there support added in spark-1.4.x submitting scala/java spark apps child process. can check more details in javadocs org.apache.spark.launcher class. link below referenced in spark d...

Pause on one of branches in DirectShow graph -

Image
i wrote app video capture. app uses following graph: as see after smart tee has 2 banches. first, "capture", use stream handling, second, "preview", show of video on app's window. user minimizes window , using preview branch not need. case stop stream on branch. i can stop , rebuild of graph without preview. don't stop/rebuild graph. perhaps, knows other method it? ideas. it's not possible stop part of graph. such scenario need multiple graphs (source, grabber, preview) , gmfbridge . by way, why need tee? can't connect video-renderer grabber?

Parsing DateTime C# not working for my format -

i want parse date datetime "26 july 2015 - 17:57:37" . problem have tried different formats on still not working. string[] formats = { "dd mmm yyy - hh:mm:ss"}; if (datetime.tryparseexact(dateoflecture, formats, cultureinfo.invariantculture, datetimestyles.none, out tempdatetime)) { lecture.dateandtime = tempdatetime; } i searched on internet , applied relevent formats never worked. you have 3 problems - months, years , hours. string[] formats = { "dd mmmm yyyy - hh:mm:ss"};

Do not submit same data twice php -

how check in php if exact same data has not been sent? this prohibit users (accidently) sending contact form twice same data on website!. thanks! you can example serialize form data , store in session variable. upon receiving form data, first check if same data present in session. can add random number form hidden input field stored in $_session["rand"]. upon first submit, random number checked equality , removed (or changed) in session array. way, single form can used once, upon second submit, number different , not accepted anymore. when generating form: $_session["rand"] = rand(); and add in form: <input type='hidden' name='rand' value='{$_session["rand"]}' /> upon receiving, check: if ( $_session["rand"] === $_post["rand"]) { $_session["rand"] = false; // continue stuff... of course, layout, single user can open single form @ same time, since opening seco...

ios - Is it possible to create a blow functionality without detecting voice? -

i need create blow functionality. using avaudiorecorder this. problem app along detection of blow detects voice. want detect blow. please guide me. using code given link https://github.com/dcgrigsby/micblow

Countdown timer javascript -

how make countdown timer same regardless time on pc. script doesn't work wanted to, can change timer changing date , time on pc. var end = new date('07/31/2015 4:10 pm'); var _second = 1000; var _minute = _second * 60; var _hour = _minute * 60; var _day = _hour * 24; var timer; function showremaining() { var = new date(); var distance = end - now; if (distance < 0) { clearinterval(timer); document.getelementbyid('giveaway1').innerhtml = 'the winner has been chosen!'; return; } var days = math.floor(distance / _day); var hours = math.floor((distance % _day) / _hour); var minutes = math.floor((distance % _hour) / _minute); var seconds = math.floor((distance % _minute) / _second); document.getelementbyid('giveaway1').innerhtml = days + 'days '; document.getelementbyid('giveaway1').innerhtml += hours + 'hrs '; document.getelementbyid('giveaway1...

android - how to get the edit text value out of an editable listview -

i created editable custom listview button outside listview. want save edittext value entered user on button click. edit text in base adapter class , list , button in activity class, i'm having problem accessing edit text list , code crashes because of null pointer exception public class productslist extends activity{ productlistadapter dataadapter; progressdialog progressdialog=null; listview listview; usersqlitedb usersqlite_obj; arraylist<products> prodlist; edittext edchemistname, edchemistaddr; button btnsave; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.productlist); edchemistname = (edittext) findviewbyid(r.id.edittext1); edchemistaddr = (edittext) findviewbyid(r.id.edittext2); btnsave =(button)findviewbyid(r.id.button1); listview = (listview)findviewbyid(r.id.listview1); usersqlite_obj = new usersqlitedb(this); progressdialog = progressdialog.show(t...

php - Laravel bad wordfilter as an helper -

Image
i'm trying make own bad word filter, , works great, exept when have multiple words in sentence. is, takes values out of database , loops trugh , must replace ad words. let me have (in dutch) sentence: deze kanker zooi moet eens stoppen! het godverdomme altijd het zelfde zooitje. . these words must been replaced in database: kanker , godverdomme . so have in database: thats good, exept when 2 ords must been replaced, doesn't want replace... my helper function: public static function filter($value) { $badwords = db::table('badwords')->get(); foreach ($badwords $badword) { $replaced = str_ireplace($badword->bad_word, $badword->replacement, $value); } return $replaced; } hope can me :) kindest regards, robin for each iteration in foreach loop, set value of $replaced whatever str_ireplace returns. @ end of function return value only last bad word should have been replaced...

How to target Windows 10 Edge browser with javascript -

i know should feature detection possible, can detect in javascript if browser microsoft edge browser? i maintain old product , want display warning features broken without having invest lot of time fixing old code. try detect features instead of specific browser. it's more future-proof. should user browser detection. with out of way: 1 option use library (there many intricacies user agent strings), or alternatively parse window.navigator.useragent manually. using parser library # https://github.com/faisalman/ua-parser-js. var parser = new uaparser(); var result = parser.getresult(); var name = result.browser.name; var version = result.browser.version; raw javascript approach # mozilla/5.0 (windows nt 10.0) applewebkit/537.36 (khtml, gecko) \ # chrome/42.0.2311.135 safari/537.36 edge/12.10136 window.navigator.useragent.indexof("edge") > -1

asp.net - TeeChart error on server server -

i having problems in implementing teecharts on server. application running on .net3.5, have migrated .net4.0. have got working on local machine if deploy on server "system.nullreferenceexception: object reference not set instance of object. " error. my application on local running on vs2013, .net4.0. deploying on windows server 2012. can please help. stack trace of error: [nullreferenceexception: object reference not set instance of object.] steema.teechart.fraccessprovider.getlicense(licensecontext context, type type, object instance, boolean allowexceptions) +153 system.componentmodel.licensemanager.validateinternalrecursive(licensecontext context, type type, object instance, boolean allowexceptions, license& license, string& licensekey) +214 system.componentmodel.licensemanager.validate(type type, object instance) +49 steema.teechart.chart..ctor() +72 steema.teechart.web.webchart..ctor() +111 this indicates teechart license not correctly compi...

java - Android Http Post -

i have problem http post connection in android. i want make connect when app starting. next want exchenge many request , response (when customer press button send request , read response) , close connect if app close. it is possible ? must close inputstream after read response ?? i have acting http post connection send post read response , close input stream if solution ? want have 1 http client. try using great library ion it handle complicate stuffs you, do ion.with(getcontext()) .load("https://koush.clockworkmod.com/test/echo") // server side script url .setbodyparameter("goop", "noop") // parameter send .setbodyparameter("foo", "bar") .asstring() .setcallback(...) more information here ( https://github.com/koush/ion )

jquery - Border-Bottom Accordion Panel in different browsers -

i have following jquery accordion in want have multiple sections open: $(document).ready(function() { $(".accordion").accordion({ collapsible: true, active: false, animate: 500, }).on("click", "div", function(e) { $("div.ui-accordion-header").each(function(i, el) { if ($(this).is(".ui-state-active")) { $(this).find(".panel-icon").html("-") } else { $(this).find(".panel-icon").html("+") } }) }); }); .accordion { float: left; line-height: 2.0; width: 100%; } .js_button { width: 99%; padding-left: 1%; font-weight: bold; border-style: solid; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; margin-top: 1%; outline-width: 0; } .panel { width: 99%; height: 20%; padding-left: 1%; font-weight: bold; border-style: s...

ios - UICollectionView not displaying cells after fast scroll -

i have uicollectionview while scroll in occasions stops updating cells. load few cells when scroll down or rest of uicollectionview empty although contensize bigger few cells visibles sizes. it happens more when scroll fast, randomly cellforitematindexpath stops being called , uicollectionview shows last loaded cells, rest of space empty. here code: [self.collectionview registernib:[uinib nibwithnibname:nsstringfromclass([newscollectionviewcell class]) bundle:nil] forcellwithreuseidentifier:nsstringfromclass([newscollectionviewcell class])]; [self.collectionview registerclass:[newsheadercollectionreusableview class] forsupplementaryviewofkind:uicollectionelementkindsectionheader withreuseidentifier:nsstringfromclass([newsheadercollectionreusableview class])]; pragma mark uicollectionviewdatasource - (nsinteger)numberofsectionsincollectionview:(uicollectionview *)collectionview { return 1; } - (nsinteger)collectionview:(uicollectionview *)collectionview numberofitemsin...

android - Touch events aren't detected in Libgdx after redrawing? -

i'm drawing menu on game screen when pause button clicked, on menu i'm drawing play button. problem once press play button touch events on game screen not detected! here's code snippet public class gamescreen implements screen { //some code here public void render(float delta) { gdx.gl.glclearcolor(0, 0, 0, 1); gdx.gl.glclear(gl20.gl_color_buffer_bit); batch.setprojectionmatrix(camera.combined); batch.begin(); if(prefs.getboolean(constants.ismenuon,false)){ menu.draw(batch, menu.getx(), menu.gety(), gdx.graphics.getwidth(), gdx.graphics.getheight()); playbtn.draw(....); } if(playbtn.istouched()){ prefs.putboolean(constants.ismenuon, true); prefs.flush(); } ...... ... batch.end(); } }

excel - How to pull out data using power query from 1 cell (link pasted in cell A1) from sheet 1 to Sheet 2? -

Image
i have link of website want pull out data through power query. every time, link changed per need. need use power query every time. there way build power query shows i'll change link , data refreshed? possible paste link in cell a1 of sheet 1 , fetch data sheet 2? please guide me. click on cell url, open menu power query > excel data > table (uncheck "my table has headers") in power query editor, right click on url cell of table , "drill down" text value. now need manual m code transformation treat variable datasource. go view > show formula bar, click fx button add custom step. add datasource call, e.g. web pages: = web.page(web.contents(column1)) you might need answer questions data privacy (after all, you're copying variable excel workbook , sending internet!). you can edit link in sheet 1, , when refresh query you'll see sheet 2 changed. edit: your full query should like: let source = excel.currentworkbook(){...

Group BY MySQL- what column to use? -

hi have following result set. need find min(diff) each id(ex.2904 min 36).if use group id not showing 36 min # id, id_contact,name,optention_date,send_date, diff 2904, 28,version 2, 2014-11-05, 2014-12-11 16:45:41, 36 2904, 28, version 1, 2014-09-01, 2014-12-11 16:45:41, 101 2903, 178,version 2, 2014-11-05, 2014-12-09 16:06:39, 34 2903, 178,version 1, 2014-09-01, 2014-12-09 16:06:39, 99 the query have select email.id, a_email_contact.id_contact, email.subject, x.name, x.optention_date, email.send_date, min(datediff(email.send_date, x.optention_date)) diff classification_element y, classification_version x , email,a_email_contact x.id_project=y.id_project , y.id_project=11 , y.id_company=3 , y.id_version=x.id , email.send_date>x.optention_date , a_email_contact.id_email=email.id group email.id order diff asc on column should use group by? the result of query # id, id_contact, subject, name, optention_date, send_date, diff 2904, 28,vers...

ios - Accelerate video speed to 10x -

actually want convert captured video 10 speed(means 10 time faster original). [compositionvideotrack1 scaletimerange:cmtimerangemake(kcmtimezero, videoduration) toduration:cmtimemake(videoduration.value*videoscalefactor, videoduration.timescale)]; its work fine when play video in mpmovieplayer freeze player, may it's because of high frame rate think. got link drop frame timecode , ntsc frame rate please me find proper solution, ...

vsto - how to set publisher name on exe in c# -

i need add publisher name when exe installs. have tried following links blogs, still not working. reference1 reference2 you can when create installer, not when application installed. use valid certificate trusted authority? the deploying office solution section in msdn describes required steps creating add-in installers.

Use of TCL script with SQL -

i want write tcl script in need use mysql. have (1) read file; (2) copy data sql table, , after (3) query data table based on requirement. unable find how copy data file sql table , how query table in tcl. load data infile 'path/filename.csv' #loading data csv file table tablename #tablename user defined fields terminated ',' #csv files use comma separated values lines terminated '\n' #till last column ignore 1 lines #ignores first row if need proc mysql_connect {} { variable mysql_dbh ; variable command set mysql_host "hostwebsite" set mysql_user "username" set mysql_password "password" set mysql_db "databasename" ## loading driver set libmysql_path "driver path" if {[catch {load $libmysql_path}]} { puts "$command error: unable load mysql file" ; exit } ...

java - Accesing field's methods in composition -

i have class player contains few private fields of other classes ( believe called composition ). public class player { private string name; private statistics statistics; private experience experience; private effort effort; } i post 1 of them called statistics public final class statistics { pool pool; edge edge; class pool { private map<stats, limitedint> map = new hashmap<>(); private int freepoints = 0; void setavailable(stats stat, int value){} int getavailable(stats stat){ return 0; } void setmax(stats stat, int value){} int getmax(stats stat, int value){ return 0; } void setfreepoints(int value){} int getfreepoints(){ return 0; } void spendfreepoints(stats stat, int amount){} } class edge { private map<stats, integer> map = new hashmap<>(); private int freepoints = 0; void setmax(stats stat, int value){}...

php - How to Rewrite engine for form submission? -

how form elements in url while using ht access file using ht access file consist of these lines rewrite engine on rewrite index.php rewrite rule ^index/([0-9 a-z a-z]+) index.php?u=$1 [nc,l] i want submit form , want url in way : website/index.php/123

node.js - NodeJS OSC receive and distribution to local network -

hi have project includes receiving real time data remote computer in osc format, want able communicate or distribute osc data other computers logged in same network. i looking in nodejs, express, socket.io , osc.js; not sure how should in terms of structure of communication. if not misunderstanding server concepts, need implement nodejs server receive , forward trough socket.io local network, ot sure though, data looging server or other address broadcasts osc data? thanks k. to send , receive data osc server need use library far know. i'm working osc server , way found send far. yes, you'll need use node.js server. use node-osc library host , receive messages, showing them on webpage tricks. to send values can search libraries, know 3 ways: arduino - there's easy-to-use library. usefull if want put arduino board anywhere , send through internet. node-osc - same library use host can use send messages server, have write .js file , run in terminal ...

angularjs facebook-login fetch user data -

Image
i working on angularjs , create login facebook using https://github.com/ciul/angular-facebook module. i'm unable fetch user data after login: my controller is: $scope.facebooklogin = function () { var promise = authenticationservices.fblogin(); promise.then( function(data){ console.log(data); }, function(error){ utilityservices.showtoast('error', 'unable connect facebook'); }); }; my services is: this.fblogin = function() { $('.btn-disable').addclass('disabled'); facebook.login(function(response) { if(response.status === "connected") { console.log(response.authresponse); facebook.api('/me', function(response) { if(!response || response.error) { deferred.reject('error occured'); } else { deferred.resolve(response); ...