Posts

Showing posts from August, 2010

linux - Exec format error, Qt5 online installer on Lubuntu -

i've looked everywhere , can't seem find answer posting here. using 64bit lubuntu vm, downloaded qt online installer from: https://www.qt.io/download-open-source the correct architecture installer downloaded after sudo chmod +x "qt-opensource-linux-x64....run" , typing in ./qt-opensource.... i get: cannot execute binary file: exec format error so don't know take here, didn't check checksum because couldn't find checksum on qt's download page download twice in case download corrupted , got same problem on both occasions. thanks!

design patterns - Multiple instances of Singleton class. Possible? -

i found this explanatory link states ensure class has 1 instance, , provide global point of access it. i appeared @ interview , surprise asked me too can singleton class have multiples instances , technology being java , objective c. answer question no believe right singleton variable being global shall check if null or not. , null first time. out of curiosity confirming it. can provide confirmation explanation weather right or wrong. the word singleton definition(of design patterns) not allows multiple instances, yeah can tweak class create multiple instances won't considered singleton definition

Trying to get property of non-object laravel? -

i beginner. i'm trying fix, think need help. -this code controller if(input::hasfile('image')){ $dest = 'media/images/product/'; $name = str_random(6).'_'.input::file('image')->getclientoriginalname(); //$resize = input::file('image')->move($dest,$name); } $loaispname = input::get('loaispname'); $loaisp = new loaisp; $datas = $loaisp->getidloaisp($loaispname); $idloaisp = $datas->id; $item = new sanpham; $item->loaisp_id = $idloaisp; $item->sanpham_name = input::get('sanpham'); $item->sanpham_img = $name; $item->sanpham_tieude = input::get('tieude'); $item->sanpham_gia = input::get('gia'); $item->sanpham_chitiet = input::get('chitiet'); $item->sanpham_vitri = input::get('vitri'); ...

javascript - What happen here? (Array and pointer) -

i typing code, when (after 3 hours searching) found (sorry, main language spanish , don't know how explain this): i have function in file makes array add object while keeping number of elements want: exports.addtoarraykeepingnum = function(ob, arr, count){ if (arr.length < count){ arr[arr.length] = ob; }else{ var auxarr = new array(); var olength = arr.length; (var = (arr.length - 1); arr.length >= count; a--){ arr.shift(); } arr[arr.length] = ob; } } but now, mongoose extract document , try make this: tools.addtoarraykeepingnum({ip: req.ip, datetime: date.now()}, doc.last_visits, 15); and then, mongoose doesn't accept document because has been changed schema... if do: var arr = doc.last_visits; tools.addtoarraykeepingnum({ip: req.ip, datetime: date.now()}, arr, 15); doc.last_visits = arr; it works... why? mean... passing reference, i'm not? should works first example... think... if can explain me, helpful! edi...

android - Refresh json thread to parse data on specific intervals -

ideally want implement method level synchronization whole method synchronized every 1minute not block level synchronization set of statements synchronized but don't know why when new runnable handler execute method @ set interval. parses unchanged json data again , again populating listview in redundant manner. how can implement handler parse data json has changed/updated previous 60seconds, without repeating data on list view? private class myasynctask extends asynctask<void, void, string> { @override protected void onpreexecute() { super.onpreexecute(); dialog = new progressdialog(regionlistactivity.this); dialog.setmessage("please wait.."); dialog.setprogressstyle(progressdialog.style_spinner); dialog.show(); } @override protected string doinbackground(void... params) { string url_structure = globaldata.main_url + sessionid + "/user_session/?sections=app...

java - Retrieving dynamic JSONObject value from server response in servlets -

hi getting access_token value dynamically server servlet request below: want retrive access_taken value in servlet program. { "access_token":"aqwp_evkqdc7e0wd09j6msmjnulvilhp304guidzl6kkgnxwnhyz_w9noxs0irodjwefvr3n3o-ic9ykc3bjyuwyrm6qbkrip3a2azudjo8ohzerzfrcmyfjjqqdjnj5j5recqdhkfjam51eiqsoexdg4u_c9xjzc1dux7qxck0p9rne0", "expires_in": 5183999 } my code below: public class demo extends httpservlet { private static final long serialversionuid = 1l; private static final string protected_resource_url = "http://api.linkedin.com/v1/people/~:(first-name,last-name,email-address)"; /** * @see httpservlet#httpservlet() */ public demo() { super(); // todo auto-generated constructor stub } /** * @see httpservlet#doget(httpservletrequest request, httpservletresponse response) */ protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { printwriter out=response.getw...

node.js - Q.all doesn't call tasks -

so have coffeescript (simplified focus on real problem) q = require 'q' events = require 'events' class someobj extends events.eventemitter constructor: () -> settimeout () => @emit 'done' , 3000 class someobj2 extends events.eventemitter constructor: () -> settimeout () => @emit 'done' , 50000 class main someobj1: null someobj2: null constructor: () -> q.all([ => @task1(), => @task2()]) .then (results)-> console.log 'results' console.log results .catch((error)-> console.log 'error' console.log error ) task1: () -> console.log 'task1 started' defer = q.defer() @someobj = new someobj() @someobj.on 'done', (err, data) => console.log 'task1 done' defer.resolve data return defer.promise task2: () -> console.log 'task2 started' ...

How to split string in NSIS -

string "jdbc:postgresql://localhost:5432/databasename" my requirement databasename above string. i tried below link not worked. ${explode} $0 "jdbc:postgresql://localhost:5432/" "$v1" it give error invalid command. http://nsis.sourceforge.net/explode how possible in nsis language. i'm not more familiar nsis language. please needful help. in advance. if need rest of string after last / can use basic nsis string handling: section strcpy $0 "jdbc:postgresql://localhost:5432/databasename" strcpy $1 0 loop: intop $1 $1 - 1 strcpy $2 $0 1 $1 strcmp $2 '/' found strcmp $2 '' stop loop found: intop $1 $1 + 1 stop: strcpy $2 $0 "" $1 detailprint "|$2|" sectionend

excel - Vba UserForm combobox items don't apear till i click on the userform -

i have command button, when click it, shows customized userform contains combobox items taken sheet cells. user suppose press command userform appears, needs select 1 item list, item sheet name in different workbook, accordingly import data sheet. facing problem: when userform appears, click on combobox shows no items, if click once on userform check combobox again shows items correctly, if click again on userform, combobox items doulbled! if selected item works perfectly. want achieve is: want combobox show items directly without clicking on userform. code this: in userform: private sub userform_click() dim mlf workbook dim adad long dim mada string dim lastrow long set mlf = activeworkbooklastrow = sheet3.cells(rows.count, 1).end(xlup).row adad = 1 lastrow mada = sheet3.cells(adad, 1) combobox1 .additem mada end next end sub private sub cmdokay_click() 'verify item selected if me.combobox1.boundvalue = vbnullstring msgbox "you did ...

ssl - PHP cURL says https not supported -

i'm making several curl requests page. after 1 post request, error in curl output * protocol https not supported or disabled in libcurl * closing connection -1 curl doesn't make request. can't figure out how solve error. the weird thing ssl enabled both cli , fpm. seen here http://cl.ly/image/1l062c2h2m2w i tried making request http:// instead of https://. didn't change anything. tried making sure server had ssl, , didn't change it. my curl calls this $fp2 = fopen('cookies/debug.txt', 'a'); fwrite($fp2, "\n $action"); fwrite($fp2, "\n $url"); fwrite($fp2, "\n ".sizeof($data)); fwrite($fp2, "\n ".json_encode($data)); fwrite($fp2, "\n_________________________________________\n"); $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, 1); if($action == "post") curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_verbose, 1); c...

postgresql - 100 columns vs Array of length 100 -

i have table 100+ values corresponding each row, i'm exploring different ways store them. without indexes, lose if store these 100 values in integer[] column in postgresql? compared storing them in separate columns. plus, since can add indexes array elemnets, create index test_index on test ((foo[1])); would there performance difference queries using such index compared regular index on column? as far i've read, performance difference come picture in arrays variable length elements; i'm not sure fixed length ones. don't go lazy way. if need store 100 , more values array, ok, if has sense has array application, data. if need query specific element of array, design not good, regardless of performances, , must use columns. in moment must delete "column" in middle or redesign it. anyway, wrote frank in comments, if values same type, consider model them table (if meaning same).

javascript - How to load the div of another webpage and not the entire page into my webpage? -

i have 2 webpages internal.html , external.html i have following piece of code in internal.html loads external.html div id "result" <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> function autorefresh_div() { $("#result").load("https://abc/external.html");// function load data other file after x seconds } setinterval('autorefresh_div()', 5000); // refresh div after 5 secs </script> i have div id "test" in external.html. how load div id "test" of external.html internal.html's div id "result" , not entire page? http://api.jquery.com/load/ loading page fragments the .load() method, unlike $.get(), allows specify portion of remote document inserted. achieved special syntax url parameter. if 1 or more space characters included in string, portion of string following first space assumed j...

How to pass php variable to include page? -

when load page index.php , why not echo $my_header index.php <?php include 'test.php'; $my_header = 'aaaaaaaaaaaaaaaaaaaa'; ?> test.php <?php echo $my_header; ?> just change 2 lines this: $my_header = 'aaaaaaaaaaaaaaaaaaaa'; include 'test.php'; also version should give error! if not recommend turn error reporting on this: <?php error_reporting(e_all); ini_set("display_errors", 1); ?> (btw: recommend use require_once script included once , errors!) see: http://php.net/manual/en/function.require-once.php

mysql - How do I sum the child table? -

i've tried query, got wrong result... looked @ many references not find answer. select a.id, sum(b1.amount) section1, sum(abs(b2.amount)) section2 parent_table inner join child_table b1 on a.id=b1.parent_id inner join child_table b2 on a.id=b2.parent_id b1.bh_status in ('section1') , b2.bh_status in ('section2') group a.id tables are: parent_table id | customer_namem | date_register ----+----------------+-------------- 1 | customer1 | 2014-20-11 2 | customer2 | 2014-21-11 3 | customer3 | 2014-22-11 4 | customer4 | 2014-23-11 5 | customer5 | 2014-23-11 child_table id | ch_key | ch_value | parent_id ----+-----------+----------+---------- 1 | deposit | 100 | 1 2 | deposit | 500 | 1 3 | withdraw | 100 | 1 4 | withdraw | 100 | 1 5 | deposit | 10 | 2 6 | deposit | 100 | 2 7 | deposit | 50 | 3 8 | deposit | 50 | 3 9 | withdraw ...

python - KeyError: 'id' when trying to index documents to Solr using sunburnt -

i trying index few text files solr using sunburnt. below code solr_url = "http://localhost:8983/solr" h = httplib2.http(cache="/var/tmp/solr_cache") solr_instance = sunburnt.solrinterface(url=solr_url, http_connection=h) url,title, webpage in webpages: html_id = hashlib.md5(url).hexdigest() doc = {"id":html_id, "content":webpage, "title":title} solr_instance.add(doc) try: solr_instance.commit() except: print "could not commit changes solr, check log files." else: print "successfully committed changes" but when run below error. file "/users/ananya/desktop/dbms project/code/extracttext/extracttext.py", line 94, in index_to_solr solr_instance = sunburnt.solrinterface(url=solr_url, http_connection=h) file "/users/ananya/anaconda/lib/python2.7/site-packages/sunburnt/sunburnt.py", line 166, in __init__ self.init_schema() file "/users/ananya/a...

mashape python unirest library -

i'm trying use unirest library run api dmoz. code: ========================================================================= import unirest response = unirest.get("https://enclout-dmoz.p.mashape.com/show.json?auth_token=something&url=www.nike.com", headers={ "x-mashape-key": "another_code" } ) html= response.body() print html but error message: typeerror object 'dict' not callable. access dict without brackets html = response.body print html

ios - how to navigate to another view controller from uiview subclass(mapviewcontroller:MKmapview) -

im doing application on mapkit shows mutiple pins on map. when user touches annotation pin user taken detailed view. problem class implemented map subclass of mkmapkit. when tried use supermarketdetailsviewcontroller *detailviewcontroller = [[supermarketdetailsviewcontroller alloc]init]; [self.navigationcontroller pushviewcontroller:detailviewcontroller animated:yes]; the error property "navigationcontroller" not found on object of type mapviewcontroller how can navigate current view view in scenario? to navigate, have embed mapviewcontroller in uinavigationcontrolelr (storyboard). crash should solved then.

How to stop different web crawlers from visiting java based web application? -

this question has answer here: how disallow specific page robots.txt 4 answers i working on struts2 based web application , want stop web crawlers visiting application. to stop requesting crawlers machines, must know ip address of machines. can create new filter application. can ip of request app in filter. if ip mapping ip address of crawler. kick request out apps. hope help.

user interface - WiX uninstall GUI -

i'm creating installer using wix project. installation of project, wix uses gui based on wixui_mondo. when application uninstalled control panel, user sees small box progress bar. want add window asking user if made backup of configuration file future use. in window want add 2 buttons 1 proceed uninstallation , abort uninstall process. i can't find on google this, guys know if possible , how can achieve this? thanks in advance you should able achieve setting arpnoremove property . disable remove button users have run modify button activate uninstall.

Android notification doesn't work properly -

i'm trying send notification @ specific time,set user via timepicker . when run app first time , works, if change time of notification app send immediately. can't figure out why. mainactivity code: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); pkg=getpackagename(); //intent openpage1 = new intent(mainactivity.this,impostazioni.class); //startservice(new intent(this, servicenot.class)); intent myintent = new intent(this , servicenot.class); alarmmanager alarmmanager = (alarmmanager)getsystemservice(alarm_service); pendingintent pendingintent = pendingintent.getservice(this, 0, myintent, 0); calendar calendar = calendar.getinstance(); sharedpreferences sharedpref = getsharedpreferences("hour",mode_private); notificah = sharedpref.getint("hour", 9); sharedpreferences sharedprefs = getsharedpreferences(...

R: pass function with multiple parameters to data frame rows, using only some columns -

what trying seems super simple, cannot around it, , i've looked around similar questions, still cannot solve it... it's stupid question, here goes... i have 1 column lists positions , 2 other list start , end, need check whether position within range defined start , end, each row... mwe: within.range <- function(pos, start, end){ if (pos>=start & pos<=end){ return(true) } else{ return(false) } } my.df <- data.frame(gene=c("a","b","c","d","e"), chr=c(1,2,3,4,5), pos=as.numeric(c(34,23,6,46,765)), start=as.numeric(c(45,15,2,32,765)), end=as.numeric(c(86,38,9,41,767))) my.df how can pass function data frame?? best attempt is: apply(my.df[,c("pos","start","end")], 1, within.range, start=my.df$start, end=my.df$end) but incorrect... maybe there whole better way accomplish same... thanks! no need in apply loops here, do with(my.df, start <= pos ...

r - How to apply indexing to paired rows -

i have following data frame representing paired observations made each id: structure(list(id = c(9000099, 9000099, 9000296, 9000296, 9000622, 9000622), variable = c(2, 0, 0, 4, 0, 1), side = c(1, 2, 1, 2, 1, 2)), .names = c("id", "variable", "side"), row.names = c(na, 6l), class = "data.frame") id variable side 1 9000099 2 1 2 9000099 0 2 3 9000296 0 1 4 9000296 4 2 5 9000622 0 1 6 9000622 1 2 i index dataframe if variable meets indexing criteria anywhere, both rows corresponding id removed. example, if index data frame variable = 4, df like: id variable side 1 9000099 2 1 2 9000099 0 2 5 9000622 0 1 6 9000622 1 2 if index variable = 1, data frame follows: id variable side 1 9000099 2 1 2 9000099 0 2 3 90...

Mass rename objects on Google Cloud Storage -

is possible mass rename objects on google cloud storage using gsutil (or other tool)? trying figure out way rename bunch of images *.jpg *.jpg. https://cloud.google.com/storage/docs/gsutil/addlhelp/wildcardnames gsutil supports uri wildcards edit gsutil 3.0 release note as part of bucket sub-directory support changed * wildcard match directory boundaries, , introduced new ** wildcard... do have directories under bucket? if so, maybe need go down each directories or use **. gsutil -m mv gs://my_bucket/**.jpg gs://my_bucket/**.jpg or gsutil -m mv gs://my_bucket/mydir/*.jpg gs://my_bucket/mydir/*.jpg edit gsutil doesn't support wildcard destination far (as of 4/12/'14) nether api . so @ moment need retrieve list of jpg files, , rename each files. python example: import subprocess files = subprocess.check_output("gsutil ls gs://my_bucket/*.jpg",shell=true) files = files.split("\n")[:-1] f in files: subprocess....

php - Unable to read GET variable when used in $page_content -

i have file called productfocus.php use variable id: $id = $_get["id"]; page used in product.php file in following manner: product.php <?php $page_content = 'productfocus.php'; // $id = $_get["id"]; include('master.php'); ?> productfocus.php <?php include "db/db.php"; $id = $_get["id"]; $product = get_product_by_id($id); ?> <div class="product-focus"> <h3><?php echo $product->name ?></h3> <img src="/images/products/<?php echo $product->image ?>"> <div id="description"> <h4>productinformatie</h4> <p><?php echo $product->description ?></p> <h4>partners</h4> <table> <?php foreach($product->partners_obj $partner) { ?> <tr> <td> ...

vb.net - NPOI Format Number As Text -

i'm trying generate excel file using vb in visual studio 2010, using npoi library. ran issue data inserted format incorrectly. for example, have user id "0001" , , i'm trying inserted excel. in output excel file, cell says "1" incorrect. looked @ format , says "text" , not "general". how can go inserting "0001" correctly instead of "1" ? i tried , it's no making changes mystyle.dataformat = hssfdataformat.getbuiltinformat("text") i tried "@" , doesn't make changes. any appreciated. make sure set celltype string if don't already. celltype = npoi.ss.usermodel.celltype.string; var cell=currentrow.createcell(i, celltype);

infragistics - Re-render igGrid after initial canceling of rendering event -

i ask advice how overcome following problem related usage of iggird: i'm using iggrid filtering , selection widgets; after data-binding of grid i'm cancelling "datarendering" event, because expect lot of data returned server , don't want displayed yet; on same page that's holding grid, there other controls user can play , based on inputs i'm creating filtering criteria; when filtering criteria ready i'm applying filtering on grid's data through "filter" method. just when of date cut-out, want show remaining; i couldn't find render or rerender method in documentation; how make gird render data again? thank, you! you need call databind method again parameter true .

cakephp - Issue in setting session when going from www.site.com to site.com -

when log in website/application www.xyz.com and dont log out of session,right after if go xyz.com instead of www.xyz.com shows not logged in. this happens both ways when log xyz.com , dont log out of sesion , go www.xyz.com shows iam logged out. should not happening.i have checked session variables , other settings still cant figure out why happening can 1 please , advise on issue. check cookie domain . if set www.xyz.com , change xyz.com .

c++ - constexpr for null-initialized constructor in a derived class -

i have similar following class base { public: explicit base(int* i) noexcept { type = new int; *type = *i; }; constexpr base(std::nullptr_t) : type(nullptr) { }; ~base() { cout << "destroying!" << endl; delete type; }; protected: int* type; }; class derived : public base { public: explicit derived(int* i) noexcept : base(i) { }; //constexpr derived(std::nullptr_t) : type(nullptr) { }; //constexpr derived(std::nullptr_t) : base(nullptr) { }; ~derived() { }; }; i achieve constexpr null constructor derived class, compiler complains lot 2 options , similar tests have done. of course code more complex, have opaque handler , destructor should behave in more complex way. resource free-ing same (no need multiple destructors, base one). i don't know how achieve this, maybe going through wrong path? ideas? expect able like: derived a(nullptr); derived b(handler1); base c (nullptr); base d (handler2); and, in cleanup, b...

Jquery UI droppable's hoverClass in not firing in mobile device -

i using jquery ui draggable , droppable achieve output http://www.casetify.com/design . here link of page. working expected in desktop width, not working in mobile emulation/device. on 3rd step of page , when image dragged sidebar mobile cover, droppable's hoverclass fired. hoverclass not getting fired in mobile emulation/device. gets fired when mouse pointed in bottom right of droppable area. below code draggable , droppable element. $('#image-pool-list img.dddraggable').draggable({ revert: "invalid", helper: "clone", //appendto: "body", //zindex: 100, live: true, refreshpositions: true, drag: function(event, ui) { $(ui.helper).css('opacity', '0.5'); $('div.design-template').css('opacity', '1'); ui.helper.css({ 'width': '90px', 'height': '90px' }); //console.log(ui.helper); }, stop: function(event, ui) { //$(...

Cyrillic characters in Python 2.7 -

the function returns places in radius using google places api. exact, use this library handle task. the problem cyrillic symbols shown this: ÐО Сбербанк РоÑÑии, КиевÑкое отделение â„–14 i tried these suggestions. tried this: pname = place.name uni = unicode(place.name) and this: convertedname = pname.encode(encoding='utf-8', errors='strict') nothing helped. else can try? list(bytearray("надра")) [208, 189, 208, 176, 208, 180, 209, 128, 208, 176] that's utf-8. if output terminal set utf-8, should need no encoding or decoding @ all. proper way read string use string.decode('utf-8') turn proper unicode string, encode before output whatever encoding terminal supports (looks vaguely ... code page 1250 or iso-8859-2 ?). https://rawgit.com/tripleee/8bit/master/encodings.html#0xd0 shows 208 (0xd0) being mapped Đ in 6 different encodings, conjecture using 1 of tho...

wordpress - Woocommerce - can't add to cart as a guest using Quick Order One Page Shop? -

using plugin @ http://products.solvercircle.com/woocommerce-one-page-quick-shop/quick-shop/ it seems if i'm logged in regular user in admin, can add items cart fine. if add cart guest ajax request , returns '1' item never added cart. does know why might so? other 2 plugins have on site deactivated , can still reproduce this, believe bug in plugin. edit : confirmed 'guests can checkout' settings box applied, doesn't seem it. edit #2 : here's add cart fn: function wqo_add_prod(pid,vid){ var qty= jquery('#product_qty_'+vid).val(); if(qty==0){ jquery('#wqo_alert_info').text('out of stock'); jquery('#wqo_alert_info').show() settimeout(function(){jquery('#wqo_alert_info').hide()}, 1500); return false; } if(vid==0){ qty= jquery('#product_qty_'+pid).val(); } var ajax_url = 'http://domain.com/wp-admin/admin-ajax.php'; jquery.aja...

C++: vector<Foo*> with reserve(), push_back() destroying values -

the title tad confusing. here compressed version of current predicament: classes.h: class foo { int x; foo(): x(0) { } foo(int y): x(y) { } }; class b { vector<foo> list; b() { } }; class { vector<b> map; a() { } }; main.cpp: vector<a> map; vector<foo*> allfoos; void initialize() { allfoos.reserve(...); } void generatemap() { (...) { a; map.push_back(a); (...) { b b; map.back().map.push_back(b); if (...) { switch (...) { case ...: foo foo(5); map.back().map.back().list.push_back(foo); allfoos.push_back(&map.back().map.back().list.back()); cout << allfoos.back()->x; // #1 break; } cout << allfoos.back()->x; // #2 } cout << allfoos.back()-...

qt - Snapping to grid doesn't work -

i trying snapping on grid such whatever draw should take gridpoints , no other points. have made grid in cadgraphicsscene.cpp , made different class snapping. grid made follows: cadgraphicscene.cpp void cadgraphicsscene::drawbackground(qpainter *painter, const qrectf &rect) { const int gridsize = 50; const int realleft = static_cast<int>(std::floor(rect.left())); const int realright = static_cast<int>(std::ceil(rect.right())); const int realtop = static_cast<int>(std::floor(rect.top())); const int realbottom = static_cast<int>(std::ceil(rect.bottom())); // draw grid. const int firstleftgridline = realleft - (realleft % gridsize); const int firsttopgridline = realtop - (realtop % gridsize); qvarlengtharray<qline, 100> lines; (qreal x = firstleftgridline; x <= realright; x += gridsize) lines.append(qline(x, realtop, x, realbottom)); (qreal y = firsttopgridline; y <= realbottom; y += gri...

express - Use of brackets bug in Swig template for node.js -

as seems swig template is not able basic stuff such having 2 conditions within brackets inside if statement, wondering how guys deal without having duplicate code: {% if( absence.approved , absence.rejected) or (demo.demo , demo.test) %} whatever {% endif %} right breaks view because swig doesn't support it ... remove brackets , should work fine {% if absence.approved , absence.rejected or demo.demo , demo.test %} whatever {% endif %}

Can we create multi dex support builds in Titanium android? -

i have been developing application in titanium android.somehow after updating titanium started getting 65k limit error , solution got : https://www.contentful.com/blog/2014/10/30/android-and-the-dex-64k-methods-limit/ how implement these in titanium ? this question asked , issue created in 2014: https://jira.appcelerator.org/browse/timob-18082 however, not resolved. (under titanium sdk 5.1.1.ga) i met problem today, , solution is: remove unnecessary jar files ! those jar files referred java class, has huge methods ( more 1k) not used @ run time, removing them not cause app crash nor throw exceptions. this not final solution, kinda of trick. whatever, works me.

regex - How can we convert regular expression to ANTLR 4 Expression -

i searching way or tool convert regular expression antlr 4 expression not find suitable. i'm curious "can convert or not." if not, assume antlr 4 expression , regular expression looks same look-wise totally different. please correct if i'm wrong. antlr lexer rules regular expressions, in formal sense. means won't pattern matching features lookahead/lookbehind/captures etc out of box. can insert custom code in rules if need more control on matching process. as syntax, it's bit different standard regex syntax. instance, in antlr write ~[a-z] instead of [^a-z]

java - Remove duplicated key Map.Entry from a List -

i have list of map.entry , in roder have list of pairs. in list , inserting pairs key long value representing unix epoch, , value string text: arraylist<map.entry<long, string>> events = new arraylist<map.entry<long, string>>(); events.add(new map.entry<long, string>(140000000, "test event")); i want remove map.entry duplicated key, each unix epoch have associated string . fancy way of doing without iterating whole list manually? bonus if string value concat of string values same key. use hashmap - allows single entry per key, overwrite. can mapentries out of map using map.entryset. works if keys same values different. just putting entries set work if key , value pairs same, i.e. identical entries, opposed having same key. behaviour of mapentry.equals() understand this.

java - Android: Passing context to helper class results in NPE -

i creating android app , trying use settingsmanager class read , write preferences. use this, have pass context settingsmanager in order use sharedpreferences api. however, code keeps giving me nullpointerexception . can tell me why? main.java @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_status); mnavigationdrawerfragment = (navigationdrawerfragment) getfragmentmanager().findfragmentbyid(r.id.navigation_drawer); mtitle = gettitle(); // set drawer. mnavigationdrawerfragment.setup( r.id.navigation_drawer, (drawerlayout) findviewbyid(r.id.drawer_layout)); setbutton(); } ... public void setbutton(){ button btn = (button) findviewbyid(r.id.button1); btn.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { settings...

objective c - Click on NSCollectionView returns always the same object -

i' ve nscollectionviewitem subclass, called myitem used item of nscollectionview . need enumerate item in collection view set delegate each item code: nsuinteger categorynumber = [self.collectionview.content count]; (nsuinteger cont = 0;cont < categorynumber;cont++) { myitem *categoryitem = (myitem*)[self.collectionview itematindex:cont]; categoryitem.interactiondelegate = self; } using debugger saw code works aspect , in each iteration myitem points different object each time. problem when use mousedown event on myitem class receive same object whatever item click on nscollectionview . seems collection view use 1 class (the cell template instance?). have idea of going on? thanks the problem in part of code , nscollectionview returns, obviously, correct object each time.

cordova - How to add our own options in Visual Studio for target platform? -

Image
how add our own options in visual studio target platform below image? open "configuration manager..." in project configuration select name new configuration: and choose desired project:

Open external console from Netbeans using Java -

is possible open external console window when executing java program netbeans, instead of standard inner console/output window inside of netbeans? have searched through project configuration , netbeans preferences without finding useful option. i know while using c/c++ possible choose config console use (inner/outer), i'm affraid it's not possible java. does have insight java matter? thanks!

Pointer variable used without initialization C Visual -

void main(){ float = 5; float *test; *test = a; } this doesn't compile. why? mean there instantly bug pointer variable cannot used without initializaiton. here's link error http://i.imgur.com/tdiyotu.png void main(){ float = 5; float *test; // pointer test contains random value // , because can not safe access memory *test = a; // not safe!. dereferencing random address give garbage. } use test = &a if want pointer have address of variable a.

swift - Text Input Controller WatchKit -

i trying use presenttextinputcontrollerwithsuggestions in watchkit app. not sure going wrong. presenttextinputcontrollerwithsuggestions(["hello", "hey"], completion: { (mystring) -> void in println(mystring) }) from ios 8.2 release notes : watchkit known issues the presenttextinputcontrollerwithsuggestions:completion: method of wkinterfacecontroller not supported in ios simulator.

How to transfer data from Amazon S3 to Amazon EC2 -

i using ec2 instance , have enabled log service of elastic load balancer. logs stored in amazon s3 , want data used dataset elasticsearch present on ec2 instance. there way can transfer data ec2 instance or access data directly s3 used elasticsearch ? the aws command line interface (cli) has commands make easy copy to/from amazon s3. you can run them on ec2 instance download data amazon s3. aws s3 cp s3://bucket/path/file . aws s3 cp s3://bucket/path . --recursive aws s3 sync s3://bucket/path .

Make views/text fit the screen on different android devices -

Image
i trying make 24 hour sidebar menu. not numbers fit on every screen. know approach me fix issue numbers show here of code on how doing right now. single item <?xml version="1.0" encoding="utf-8"?> <textview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/car_history_sidemenu_item" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:padding="3dp" android:textsize="14sp" /> the layout <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <relativelayout android:layout_width="match_parent" android:layo...

php - I am getting notice undefined index but the index is there -

i keep getting notice:undefined index: upfile in /home/hostnile/public_html/v2/ar/includes/content/career.php on line 93 this in line 93 $mycv = $_files['upfile']['name']; <div class="cointainer"> <label for="upfile" class="f_right width_165">upload file</label> <input type="file" name="upfile" id="upfile" class="f_right" style="direction:rtl;"/> </div> what doing wrong here? how solve this? edit the html full code <div class="bgpages"> <div class="contentpages"> <div class="width_818 career"> <div class="header"><span>يشرفنا دائما أن ينضم إلى فريق عملنا باحثون جدد عن الأفضل</span></div> <form id="apply career" method="post" action="<?php $_server['php_s...

haskell - Is there a term for a monad that is also a comonad? -

i'm wondering whether there's concise term that's both monad , comonad. i've done searching, , know these structures exist , haven't found name them. such creature, subject conditions, called "hopf monad" or "bimonad" ( http://ncatlab.org/nlab/show/hopf+monad ). however, requires fulfilling number of axioms regarding distributive properties, , haven't seen come in programming context in particular way.

c++ - Value type of the class complex, or class itself -

i'm trying have class similar following #include <cstdlib> #include <iostream> #include <typeinfo> #include <type_traits> #include <complex> template<class k, class t = typename std::conditional<std::is_class<k>::value, typename k::value_type, k>::type> class { public: k v; t u; void type() { std::cout << typeid(u).name() << std::endl; } }; int main() { a<std::complex<double>> a; a.type(); a<std::complex<float>> b; b.type(); a<float> c; c.type(); a<double> d; d.type(); return 0; } such ouput be: d f f d stated otherwise, need variable u of type t if k of type std::complex<k> , or k otherwise. can achieved c++11 ? thanks. you can use partial specialization right type, maybe this: template <typename t, bool> struct valuetype { using type = t; }; template <type...

vba - Copy paste Excel data in -

i have 2 sheets, sheet1 , sheet2. sheet1 data have copy data , paste in sheet2, again sheet1 have copy different set of data , paste in sheet2 last line, pasted data 1st time sub copy_chains_to_other_sheet() activesheet.range("$a$1").autofilter field:=8, criteria1:="<>1", _ operator:=xland activesheet.range("$a$1:$i$681").autofilter field:=1, criteria1:="=*antaris*" _ , operator:=xland range("a1").select range(selection, selection.end(xldown)).select range(selection, selection.end(xltoright)).select selection.copy activesheet.next.select activesheet.paste activesheet.range("$a$1").autofilter field:=1 end sub this macro wrote, don't know how proceed. because 1 time have 5 rows of data time need copy data sheet1 , paste in sheet2 , next set of data need paste in 6th row, time have 8 row of data time need paste next set of data 9the row onwards, how deal this. thanks in advance answering. regards, vign...

java - Check enum for multiple values -

i have enum filetype public static enum filetype { csv, xml, xls, txt, fixed_length } filetype filetype = filetype.csv; is there better (cleaner) way check filetype multiple values following (like "mystring".matches("a|b|c"); )? if(filetype == filetype.csv || filetype == filetype.txt || filetype == filetype.fixed_length) {} why not use switch : switch(filetype) { case csv: case txt: case fixed_length: dosomething(); break; } this same if statement check, it's more readable, imho.

php - How to make a route filters base on user type in Laravel 4? -

goal : want make route filter in laravel 4 using route::group , route::filter description i have 2 types of user : internal distributor for, internal , have 2 groups: admin regular for distributor , have 4 groups: gold silver bronze oem eligible route oem distributor eligible 5 routes. route::get('distributors/{id}', array('before' =>'profile', 'uses'=>'distributorcontroller@show')); route::get('distributors/{id}/edit', 'distributorcontroller@edit'); route::put('distributors/{id}/update', array('as'=>'distributors.update', 'uses'=>'distributorcontroller@update')); route::get('catalog_downloads','catalogdownloadcontroller@index'); route::get('catalog_downloads/{id}/download','catalogdownloadcontroller@file_download'); regular distributor eligible 8 routes. route::get('distributors/{id}',...