Posts

Showing posts from June, 2014

java - Elasticsearch - Search Term is broken down and pulls unwanted results -

if search query 'elasticsearch', pulls documents has content 'search'. example - {"query":{"bool" : {"should": [{ "match" : { "title" : "cocacola" } }]}}} this query pulls documents containing title - 'cola' too. how can avoid documents appearing.

javascript - Memory game is removing any div even if the innerHTMLs do not match -

i creating basic memory game. want remove divs if first clicked div's innerhtml matches second, reason remove divs no matter 2 divs clicked. how fix issue? var picker = null; var pickertwo = null; var count = 0; function flip(event) { if (count === 0) { event.currenttarget.style.opacity = "1"; picker = event.currenttarget; count++; } else if (count === 1) { event.currenttarget.style.opacity = "1"; pickertwo = event.currenttarget; if (picker.innerhtml === pickertwo.innerhtml) { settimeout(function() { var bigboy = picker.parentnode; var littleboy = pickertwo.parentnode; bigboy.removechild(picker); littleboy.removechild(pickertwo); bigboy.parentnode.removechild(bigboy); littleboy.parentnode.removechild(littleboy); }, 800); } else if (picker.innerhtml != pickertwo.innerhtml) { settimeout(function() { picker.style.o

opengl es - Open GL ES creating Off-screen -

i stuck following while creating off-screen surface using opengl es 2.0 : 1. how create off-screen surface using eglcreatepixmapsurface()? 2. eglcreatepixmapsurface() api takes eglnativepixmaptype parameter, eglnativepixmaptype ? how find structure definiton? can make on own? ( in code base declare void * ) 3.once drawing done on native pixmap surface, how access native pixmap data? i have searched in internet alot find relevant informative examples.any appreciated.

server - is it possible to connect Openfire via http request? -

suppose have openfire xmpp server, 10 android tablab connected , able communicate each other via openfire server. , there server third party call server a. possible let server send http request openfire server config setting? such create chat room, delete chat room , on. yes can create chat rooms on http request of openfire muc service plugin. can download plugin here: http://www.igniterealtime.org/projects/openfire/plugins.jsp full documentation rest interface here: https://www.igniterealtime.org/projects/openfire/plugins/mucservice/readme.html e.g. create chat room: header: authorization: basic ywrtaw46mtizndu= header: content-type: application/xml post http://example.org:9090/plugins/mucservice/chatrooms payload example 1 (required parameters): <chatroom> <naturalname>global-1</naturalname> <roomname>global</roomname> <description>global chat room</description> </chatroom> if need create

android - How to put a query using cursor loader? -

this sqlite query , need use in cursor loader. select * triphistory _startdate > date('now','-8 days'); i try not working code given below . please check this. c = new cursorloader( this, hollacontractclass.hollas.trip_history_uri, projection, hollacontractclass.hollas.hollatriphistorycolumns.status + " =? , " + hollacontractclass.hollas.hollatriphistorycolumns.start_date + " >?", new string[] { "finished", "date('now','-8 days')" }, hollacontractclass.hollas.hollatriphistorycolumns.start_date + " asc"); but return 0 .. in advance sql parameters ( ? ) strings not interpreted in way. the values in start date column compared against literal string date('now','-8 days'

php - check if the current post is one of the recent 5 post -

i making code in wanted check current post have opened 1 of recent 5 post in word press or not . know current post id can by get_the_id(); and can check if post exist by if ( false === get_post_status( $id ) ) { // post not exist } else { // post exists } but how check value if 1 of recent 5 post or not ? because every , recent post change . i loop through top 5 posts. check if there match. function isrecentpost($id) { $recent_posts = wp_get_recent_posts(array('numberposts' => '5')); foreach ($recent_posts $post) { if($post['id'] == $id) { return true; } } return false; }

php - How to connect to two different MySQL DB in the same class -

i have class called database . looks this class database { private $conexion; private $paisconexion; var $db; function __construct($db='default') { $this->db = $db; include '../settings/variables.php'; if(isset($bbdd)){ $conexion = mysql_connect($bbdd["server"], $pais[0]['user'], $pais[0]['pass']) or die('no se pudo conectar: '.mysql_error()); // seleccionamos la base de datos mysql_select_db($x[0]['database']) or die('no se pudo seleccionar la base de datos'); if($conexion) { $paisconexion = mysql_connect($bbdd["server"], $pais[$this->db]['user'], $pais[$this->db]['pass']) or die('no se pudo conectar: '.mysql_error()); mysql_select_db($pais[$this->db]['database']) or die('no se pudo

asp.net - IE Compatibility mode change using javascript -

hi aspx page having third party controls , not appearing when upgrade ie version 11. till ie10 worked fine. and when change compatibility mode of ie http://winaero.com/blog/how-to-enable-compatibility-view-in-internet-explorer-11-ie11/ my controls working fine. cant ask end user same. is there way handle this? tried adding below tag in section of page. <meta http-equiv="x-ua-compatible" content="ie=emulateie9"/> but not working. can 1 tell me how handle through code? it's ie=9 , not ie=emulateie9 : <meta http-equiv="x-ua-compatible" content="ie=9"/> more here: how use x-ua-compatible . of course, @ migrating new or different controls work modern engine. quote article above: it not best practice let issues example linger application @ risk of falling further behind web standards progress.

How to generate Localizable.strings file from strings.xml in Android -

i want strings in strings.xml converted ios localizable.strings format format: "string"="string" i have used few online tools in web converts xml localible.strings, format have seen : "key"="value" but need in format: "value"="value" example: if strings.xml file, <resources> <string name="addtocart">please add cart</string> </resources> the localizable.strings format should in : "please add cart"="please add cart" (i need this) and not "addtocart"="please add cart" (format resulted conversion tools in web) is there plugin or built in functionality in eclipse. new android , localization process. can 1 me out in achieving please... thanks in advance. a pretty simple awk bash script can job. awk ' begin{ fs = "^ *<string *| *>|<\/string> *$|^ *<!-- *| *--&g

c# - OData v4 Web API XML response nesting too deeply -

i building odata web service using webapi , odata v4. imagine have 2 entities want expose through service: student , teacher. now student has teacher 1 of properties , teacher has many students. i able service return xml using trick: ilist <odatamediatypeformatter> odataformatters = odatamediatypeformatters.create(); config.formatters.insertrange(0, odataformatters); however xml formatter seems want format everything. mean when ask teacher, returns me students. issue arises of infinite loop each of student has teacher , teacher has students, etc. stack overflow exception. i have tried solution proposed here of http://www.asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serialization#handling_circular_object_references still somehow stack overflow exception. to around issue have had cut loop saying teacher doesn’t have students anymore loop cut , stack overflow doesn’t occur anymore. however, removes students navigation property of teacher. is t

c# - Is there a way to create a mock object and only mock one of the Property, and let the others -

is there way create mock object , mock 1 of property, , let others (properties , methods) links original class, without having mock methods test method --> var test= new mock<test>().as<itest>(); test.callbase = true; test.setupget(m => m.datenow).returns(datetime.now.adddays(10)); double num= test.object.calc(); interface --> public interface itest { double calc(); datetime datenow { get; } } class --> public class test : itest { public datetime datenow { { return datetime.now.date; } } public double calc(){ datetime d = datetime.now.adddays(100); return (datenow - d).totaldays; } always num = 0.0; yes, can, provided make use of both callbase call concrete class, , as<> target appropriate interface / base class: var mockclass = new mock<myclass>().as<imyinterface>(); mockclass.callbase = true; mockclass.setupget(m => m.property1).returns(&quo

python - How to decode raw binary to hex -

i'm required decode raw binary value looks b'\xa3\x13\xa4;\xcb\xda\x1b\x1b,ut\xde\xeb2\xb5\x84\xe5&\x85;' hex value 0x90d152b5ed57e00336fd8e106a7bce28fc3ea588 . i've tried use raw_bin.decode("hex"), tells me use codecs.decode() , i'm lost.. how can decode b'\xa3\x13\xa4;\xcb\xda\x1b\x1b,ut\xde\xeb2\xb5\x84\xe5&\x85;' 0x90d152b5ed57e00336fd8e106a7bce28fc3ea588 in python? use binascii.hexlify >>> x = b'\xa3\x13\xa4;\xcb\xda\x1b\x1b,ut\xde\xeb2\xb5\x84\xe5&\x85;' >>> binascii.hexlify(x).decode() 'a313a43bcbda1b1b2c5574deeb32b584e526853b' convert number using int base parameter 16: >>> int(binascii.hexlify(x), 16) 931003516565576134942949873523045876335469036859 >>> int(binascii.hexlify(x), 16) == 0xa313a43bcbda1b1b2c5574deeb32b584e526853b true

javascript - how to create multiple json arrays and pass all arrays in the same function -

i new json , stuck @ simple syntax not able figure out i have json: {"full_talktime":[ {"talktime":"300", "validity":"lifetime","price":"rs 300", "description":"200 full talktime"}, {"talktime":"300", "validity":"lifetime","price":"rs 300", "description":"200 full talktime"}, {"talktime":"300", "validity":"lifetime","price":"rs 300", "description":"200 full talktime"}, {"talktime":"300", "validity":"lifetime","price":"rs 300", "description":"200 full talktime"}, {"talktime":"300", "validity":"lifetime","price":"rs 300", "description":"200 full talktime"}, {"talktime&quo

GAS - Dropdown List In Google Form -

i'm trying add items 'listitem' spreadsheet displayed whenever user enters google form. copied google developer reference, var form = formapp.openbyid('1234567890abcdefghijklmnopqrstuvwxyz'); var item = form.addlistitem(); item.settitle('do prefer cats or dogs?'); item.setchoicevalues(['dogs', 'cats']); how loop add in items? current code below flawed. var items = form.getitems(); var item = items[1]; var itemlist = item.aslistitem(); var ss = spreadsheetapp.openbyid("123456").getsheetbyname('list').getdatarange().getvalues(); (var = 1; < ss.length; i++){ var row = teacherss[i]; itemlist.setchoices([row[i]]); } for adding values listitem, can way function testadding(){ var form = formapp.getactiveform(); var item = form.addlistitem(); item.settitle('do prefer cats or dogs?'); var ss = spreadsheetapp.openbyid("123456").getsheetbyname('list').getdatarange().getvalues

ios - Facebook Invite Tokens vs FBWebDialogs -

i submit ios app app store. it's first version of app doesn't have visible itunes connect link yet. i trying develop "invite facebook friends" functionality. started following tutorial. https://developers.facebook.com/docs/games/invitable-friends/v2.2 able invite tokens have no idea how use send requests other users. there nothing in documentation it. possible @ all? after couple of days of torture tried use fbwebdiealogs. using this [fbwebdialogs presentrequestsdialogmodallywithsession:nil message:@"try myapp" title:nil parameters:nil handler:^(fbwebdialogresult result, nsurl *resulturl, nserror *error) { if (error) { // error launching dialog or sending request. nslog(@"error sending request."); } else { if (result == fbwebdialogresultdialognotcompleted) { // user clicked "x" icon nslog(@"user canceled request."); } else {

regex - Get specific Value as String c# -

simple: i messagebody xitem.body : "<html>\r\n<head>\r\n<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n</head>\r\n<body>\r\ndies ist test nummer 3\r\n</body>\r\n</html>\r\n" and need save content between <body>\r\n \r\n</body> like: m_description = xitem.body; what's easiest! way ? thanks feedback regarding external tool. use in future now, problem coded function: private string extractbetweenbodytags(string str1) { if ( ! string.isnullorempty(str1)) { int p1 = str1.indexof("<body>\r\n"); if (p1 >-1) { string str2 = str1.substring(p1 + "<body>\r\n".length); int p2= str2.indexof("\r\n</body>"); if (p2 > -1) { str2 = str2.su

ant build script pass args to java task -

i desperately try pass args java program. i this: <java classname="com.openedi.unece.xsd.xsdfilegenerator" fork="true"> <arg value="-version"/> <arg value="${version.uppercase}"/> <arg value="-directoryname"/> <arg value="${project.dir}"/> <arg value="-messagetype"/> <arg value="${messagetype}"/> <classpath> <pathelement location="${lib.dir}/edifactconverter.jar" /> </classpath> </java> all properties have default values set in build script, not work. thanks suggestions matthias make sure set default values correctly. complete ant script this: <?xml version="1.0" encoding="utf-8" standalone="no"?> <project basedir="." default="start" name="

c++ - Parsing QByteArray -

i have file name qbytearray qstring file_name = "icon.jpg"; qbytearray qba1; qba+=file_name; i have contents of file qbytearray qfile file("c:\\devel\\icon.jpg"); if (file.open(qiodevice::readonly)){ qbytearray content = file.readall(); } how connect file name , contents of 1 variable of type qbytearray? how parse variable qbytearray file name , content? simplest way start length of filename, filename itself, followed data. parsing data simple reading filename-length first, read filename, data. qbytearray qbafilename((const char*)(file_name.utf16()), file_name.size() * 2); qbytearray bytearray; qdatastream stream(&bytearray, qiodevice::writeonly); stream << (int)qbafilename.size(); // put length of filename on stream stream << qbafilename; // put filename on stream stream << file.readall(); // put binary data on stream

javascript - Remove input value jquery -

each time click on option data-type should appear in input. but want if value in .val of input should not appear anymore , if click twice want remove data-type input. here jsfiddle: $('.checkbox').on('click', function () { var type = $(this).data('type'), answer = $('.answer'), initial = $('.answer').val(); $(this).toggleclass('checked'); if (answer.val().length === 0) { answer.val(type); } else { answer.val(initial + ',' + type); } }); http://jsfiddle.net/xbwocrf3/ thanks! one solution using jquery map: $('.checkbox').on('click', function() { $(this).toggleclass('checked'); //save values of checked in array var answervalues = $(".checkbox.checked").map(function() { return $(this).data("type"); }).get(); //update input text values $

r - Splitting a dataframe by column name indices -

this variation of earlier question. df <- data.frame(matrix(rnorm(9*9), ncol=9)) names(df) <- c("c_1", "d_1", "e_1", "a_p", "b_p", "c_p", "1_o1", "2_o1", "3_o1") i want split dataframe index given in column.names after underscore "_". (the indices can character/number in different lengths; these random examples). indx <- gsub(".*_", "", names(df)) and name resulting dataframes accordingly n end 3 dataframes, called: df_1 df_p df_o1 thank you! here, can split column names indx , subset of data within list using lapply , [ , set names of list elements using setnames , , use list2env if need them individual datasets (not recommended of operations can done within list , later if want, can saved using write.table lapply . list2env( setnames( lapply(split(colnames(df), indx), function(x) df[x]), paste

xcode6 - ios 7.1 simulator doesn't download in xcode 6.1.1 -

Image
i have xcode 6.1.1 , want run app in deployment target : ios 7.0 , tried download ios 7.1 simulator, the progress bar still white (no progress) how fix problem? , there way download simulator? when put deployment target : ios 7.0 default simulator doesn't run , run in deployment target : ios 8.0. note : using swift if has affect , mac os version : os x yosemite 10.10.1 are using laptop? having issue while trying download xcode. actual culprit turned out my laptop not being plugged in . apple products seem halt downloads on battery power. reason xcode doesn't show message whereas app store complains. plugged in laptop , started downloading.

How does Go! AOP PHP and PHP Deal override a class with given annotations in the same namespace? -

whilst reading design contract, came across php-deal . now, demo code looks this: /** @var composer\autoload\classloader $loader */ $loader = include __dir__.'/../vendor/autoload.php'; $loader->add('demo', __dir__); include_once __dir__.'/aspect_bootstrap.php'; $account = new demo\account(); $account->deposit(100); echo $account->getbalance(); the demo\account class looks this: class account implements accountcontract { /** * current balance * * @var float */ protected $balance = 0.0; /** * deposits fixed amount of money account * * @param float $amount * * @contract\verify("$amount>0 && is_numeric($amount)") * @contract\ensure("$this->balance == $__old->balance+$amount") */ public function deposit($amount) { $this->balance += $amount; } /** * returns current balance * * @contract\ensure(&quo

Limitation of free plan in firebase -

Image
what meaning of following? 50 max connections, 5 gb data transfer, 100 mb data storage. can explain me? thanks edit - generous limits hobbyists firebase has updated free plan limits have 100 max connections 10 gb data transfer 1 gb storage that means can have 50 active users @ once, 5gb data transferred within 1 month , store 100 mb of data. i.g. have online web store: 50 users can there @ once, 100 mbytes of data (title, price, image of item) can stored in db , 5 gb of transfer - means web site available deliver users 5gb of data (i.e. page 1 mbyte size , users able attend page 50 000 times). upd: verify size of page (to define if 5gb enough you) - using google chrome right click anywhere on page - "inspect element" , switch tab "network". refresh page. in bottom status bar amount of transferred data (attached size of current stackoverflow page, 25 kbytes)

oracle - Passing argument from psql command invoked from batch or shell to a .sql file postgres -

scenerio i calling .sql file runtest.sql , seeting variable through -v command psql.exe -w -f d:\testfolder1\runtest.sql -v v1='test' -o d:\testfolder1\test1.txt content of runtest.sql select :v1 \copy ( select 2+3 )to c:\:v1.txt; the first command working per expectation v1 printed test but second command od copy giving error :v1 not defined . want make file run time parameteres passed

java - String Pool - String Object - Garbage Collection -

confused how garbage collection works in below cases. considering below piece of code. string s1 = "abc"; // s1 points "abc" string s2 = s1; // s2 points "abc" string s3 = "abc1"; // s3 points "abc1" s1 = s3; // s1 points "abc1" s2 = null; // s2 reference removed, "abc" no longer referenced after this, "abc" eligible gc . also if same above example, if use new string() string s1 = new string("abc"); now result. also there tools, through can monitor garbage collection, objects getting collected gc string s1 = "abc"; // s1 points "abc" here, "abc" added string constants pool , usually not gced. string literal (within double quotes) usually not gced. string s1 = new string("abc"); the above line creates 2 strings. "abc" added string constants pool (assuming not present there already) , string value "ab

mysql - is there a way to display image from database using $result->fetch_row in php? -

hello i'm newbie in php , i'm working in project right now. use mysql database , i'm using object oriented style of coding. problem don't have idea of how display image using object oriented style.. here codes: <?php $sql2="select id, name, item_price, item_size, item_color, picture, category, type item "; $result2 = $conn->query($sql2); if ($result2) { while ($row = $result2->fetch_row()) { ?> <tr> <td><?= $row[0]?></td> <td><?= $row[1]?></td> <td><?= $row[2]?></td> <td><?= $row[3]?></td> <td><?= $row[4]?></td> <td><img src="data:image/png;base64,<?= $row[5]?>" alt="" /></td> <td><?= $row[6]?></td> <td><?= $row[7]?></td> </tr> &l

javascript - To get selected id of the dropdown -

in below code have dropdown in want selected id of product dropdown .pls me this. to id of product: function myfunction() { $.ajax({ type: "post", url: "orderform.aspx/insertdata", data: "{'productid':'" + $("#<%=productname.clientid%>").val() + "','quantity':'" + $("#<%=txtquantity.clientid%>").val() + "'}", contenttype: "application/json; charset=utf-8", datatype: "json", async: "true", cache: "false", success: function (msg) { alert("success"); // on success }, error: function (x, e) { alert("fail"); // on error } }); } <editable:editabledropdownlist id="product

xslt - how to refer the value of an xml tag that is passed as value to another xml using xsl -

i have xml goes this: <root> <content> <paragraph> <image reference="folder-1/folder-2/imagefile.xml"/> </paragraph> </content> </root> in reference "folder-1/folder-2/imagefile.xml", have path of image file value xml tag. how access image file , pass path value tag's src attribute? i tried solution posted in read properties file or text file in xsl , did not work. there other way can done? welcome. in advance. edited: the imagefile.xml contains following code: <container> <element> <imagepath> folder/folder/imagename.jpg </imagepath> <altimage> folder/folder/altimage.jpg </altimage> </element> </container> when meant solution did not work meant img tag coming in html output has src attribute's value empty this: <img src="" alt="&quo

delphi - How to manage constantly changing project run-time parameters in the IDE? -

in (xe2) ide have switch settings project options/ debugger / parameters because i'm testing different client configurations, databases etc. the parameters dropdown list becoming unmanageable. since these have no descriptions either, it's hard figure out ones remove ( how can clean parameters field in run -> parameters menu? ). any smart ideas on managing these? in ideal word give them tag/description, reorder them, delete some... not ideal workaround add redundant tag parameter first parameter. that way @ least, when use dropdown list, you'll have some indication on parameter combination using.

python - My emacs-jedi won't find a package -

in .emacs have (setenv "pythonpath" "/home/username/python-packages") have packages use , develop. unfortunately, emacs-jedi won't find them, , won't autocomplete them. how can debug , solve problem? for reference, here jedi:show-setup-info : ;; emacs lisp version: (:emacs-version "24.3.1" :jedi-version "0.2.0alpha2" :python-environment-version "0.0.2alpha0") ;; python version: ((:version "2.7.3 (default, feb 27 2014, 19:58:35) \n[gcc 4.6.3]" :name "sys" :file nil) (:version "0.8.1-final0" :name "jedi" :file "/home/username/.emacs.d/.python-environments/default/local/lib/python2.7/site-packages/jedi/__init__.pyc") (:version "0.0.5" :name "epc" :file "/usr/local/lib/python2.7/dist-packages/epc/__init__.pyc") (:version "0.0.3" :name "sexpdata" :file "/usr/local/lib/python2.7/dist-packages/sexpdata.pyc")) ;; c

java - Start intent "silently" -

following on this question, there way start intent in android without prompting user anything? right now, retrieving image this: public void changeimage(view view) { intent intent = new intent(); intent.settype("image/*"); intent.setaction(intent.action_get_content); startactivityforresult( intent.createchooser(intent, getresources().getstring(r.string.select_picture)), pick_image); } then store uri, , when necessary display image (i resize first, doesn't matter): uri _uri = uri.parse(_path); inputstream imagestream = null; try { imagestream = getcontentresolver().openinputstream(_uri); } catch (filenotfoundexception e) { e.printstacktrace(); } bitmap b = bitmapfactory.decodestream(imagestream); iv.setimagebitmap(b); i retrieve image data given uri "silently" invoking intent relevant permission. need like: edit: i tried setpackage() method. code has following behavior: if action_view intent used, gal

html - How to implement Rich Snippets -

i looking include rich snippets site i'm building customer. customer requested because wants organic search results show review stars. i have read blog posts rich snippets none of them show or tell me change in source code review stars show in google. i've got following data @ disposal: company name site name review average total reviews to add upon story (in hopes of making more clear): i'm working on webshop. let's call example.com. after customers made purchase in webshop receive email asking them if want rate webshop. client wants ratings (stars) visible in organic search results. i've learned rich snippets required this. not understand how these rich snippets should look, need place them, , especially. type of rich snippet need this. google documents rich snippets . case: reviews review ratings enabling rich snippets reviews , ratings the examples still use inactive vocabulary data-vocabulary.org, explained in header, want us

mysql - After upgrading to MariaDB 5.5 connections are being dropped after a period of inactivity -

we have upgraded our database server mysql 5.1 mariadb 5.5 (5.5.40-mariadb-1~wheezy-log). after upgrade, long running processes mysql connection si being dropped. common scenario processes is: connect mysql run queries do heavy lifting without connecting mysql @ least 1 minute try query against original connection exception giving 2600 error - mysql server has gone away this happen in php cli scripts (php 5.3), in ruby application (redmine 2.5.1). not happening mysql 5.1 , there no changes on applications side, should not app-related. the %timeout% variables in mariadb are: +----------------------------+----------+ | variable_name | value | +----------------------------+----------+ | connect_timeout | 5 | | deadlock_timeout_long | 50000000 | | deadlock_timeout_short | 10000 | | delayed_insert_timeout | 300 | | innodb_lock_wait_timeout | 50 | | innodb_rollback_on_timeout | off | | interactive_timeout

mysql - How to make a table view in php -

Image
i net sure called want make table dynamic. top named "tier" , values taken database table named "tier". on side there "items" "items" table database. have made intermediate table many many relationship an item have man tiers tier has many items . in intermediate table storing item id , tier id. i have manged display tiers , items dynamically according database, im not sure how fill data now. what want take values intermidate table , insert it. value boolean either true or false. example want check if silver tier has photo, if equals true want display it. how can such thing because cant wrap head around it. here code did generate table, if there improvement can make please tell me want learn code better if possible. <table> <tr> <td></td> <?php $counter = 0; //to show of tiers foreach ($tier $tier) { $counter ++; ?> <td>

asp.net - JQgrid date format in dd-MMM-yyyy -

i using jqgrid , our date showing in 20-nov-14 format want display date in 20-nov-2014 format sortable propertiy true. { name: 'dateofbirth', index: 'dateofbirth',sortable: true, width: 30, formatter: 'date', formatoptions: { newformat: 'd-m-y' } } you should use formatter: 'date', formatoptions: { newformat: 'd-m-y' } with y instead of y . way jqgrid uses php date format in format options.

android - Swipe dismissing service notification -

thought wouldn't problem @ all, still. service notification doesn't want swipe-dismiss no matter do. i have progress notification, started in service using startforeground(id, notification). here how build it: public notification createerrornotification(string message) { notificationcompat.builder builder = new notificationcompat.builder(getapplicationcontext()); intent showappintent = new intent(getapplicationcontext(), mainactivity.class); showappintent.setaction(intent.action_main); showappintent.addcategory(intent.category_launcher); pendingintent pendingshowappintent = pendingintent.getactivity(getapplicationcontext(), 10, showappintent, pendingintent.flag_cancel_current); builder.setcontenttitle(getstring(r.string.label_download_error)) .setwhen(0) .setcontenttext(message) .setcontentintent(pendingshowappintent) .setautocancel(true) .setongoing(false) .se

sql server - PHP mssql_affected_rows vs mssql_rows_affected -

i use php 5.4.24 microsoft sql server 2008r2, both on windows , linux. on linux, use freetds-0.91-clean. on windows, in phpinfo() mssql extension says "library version: freetds" the function mssql_affected_rows: works on linux, not on windows is consistent other databases (e.g. sybase_affected_rows, mysql_affected_rows, pg_affected_rows) is not documented on www.php.net the function mssql_rows_affected: works on windows, not on linux is not consistent other databases (e.g. sybase_affected_rows, mysql_affected_rows, pg_affected_rows) is documented on www.php.net why these 2 names? makes hard have same code running on both systems. for future readers, here wrapper wrote works in both cases: function getaffectedrows() { if ( function_exists( 'mssql_affected_rows' ) ) return mssql_affected_rows( $conn ) ; else return mssql_rows_affected( $conn ) ; } reference: http://php.net/manual-lookup.php?pattern=mssql_affec

r - avoiding warning with CRAN check -

i have r package code like: #' ...lots of roxygen documentation... fn <- function(long, list, of=optional, arguments=optional) {...} ... #' @export #' @rdname fn %f% <- fn where %f% call fn(long, list). this gives warning when checked r cran check : * checking code/documentation mismatches ... warning codoc mismatches documentation object 'refset': %f% code: function(long, list, of=optional, arguments=optional) docs: function(long, list) argument names in code not in docs: of=optional, arguments=optional i not write separate function %f% , since add code complexity. documentation usage ... long %f% list as now, since indeed how %f% should called. there way keep cran robot happy without confusing users , doing stupid stuff?

r - Rollmean with element value dependant window? -

i'm looking fast way following: there factor f m levels , length n. n huge (millions). m thousands. want calculate each element x in f rolling frequency of x's level within f. for example if have 2 levels , factor [1,2,2,2,1,1,2,1,2,1,1,1,2] rolling window 3 result supposed [1/3, 1/3, 2/3, 1, 1/3, 2/3, 1/3, 2/3, 2/3, 2/3, 2/3, 1, 1/3] that done zoo::rollmean (pseudocode): res <- rep(na, n) foreach level in {m} { ids <- (f == m) res[ids] <- rollmean(f == m, 3, fill = 0, align="right") [ids] # running rollmean on logical vector. first 3 elem wrong did't find suitable fill parameter. } edit: if run pseudocode above you'll wrong result (first 2 values corrupted) didn't find right fill= param rollmean() make work first 2 elements , window 3 assumed. but damn slow, bcs logical vector sparse (most values false). what generate seq(1, n) (list of indexes) , split tapply() f's levels. give me list of indexes each level. great go on eac

go - Most efficient way to read Zlib compressed file in Golang? -

i'm reading in , @ same time parsing (decoding) file in custom format, compressed zlib. question how can efficiently uncompress , parse uncompressed content without growing slice? parse whilst reading reusable buffer. this speed-sensitive application , i'd read in efficiently possible. ioutil.readall , loop again through data parse it. time i'd parse it's read, without having grow buffer read, maximum efficiency. basically i'm thinking if can find buffer of perfect size can read this, parse it, , write on buffer again, parse that, etc. issue here zlib reader appears read arbitrary number of bytes each time read(b) called; not fill slice. because of don't know perfect buffer size be. i'm concerned might break of data wrote 2 chunks, making difficult parse because 1 uint64 split 2 reads , therefore not occur in same buffer read - or perhaps can never happen , it's read out in chunks of same size written? what optimal buffer size, or there way

jquery - Angular table performance -

im trying draw table more efficient way have directive cells complex. consist of ng-repeats example. noticed ng-repeat creates new scope. ive got nested ng-repeat wchich results in tons of scopes. noticed linking veeery slow. how optimize that? if using angularjs 1.3 can use one-time binding operator :: for example on ng-repeat <ul> <li ng-repeat="item in ::items">{{item.name}};</li> </ul> for more details can see link below: https://docs.angularjs.org/guide/expression

java - Terminating ThreadPool-Threads hanging in swt syncExec -

when disposing display threadpool threads hang in swt syncexec call. how can avoid situation , cleanly shutdown threads? calling shutdownnow inside shell disposelistener not work. the following example shows runnable executed threadpool thread. can find complete code here: http://www.java-forum.org/awt-swing-javafx-and-swt/164617-threadpool-sicher-beenden-verwendung-swt-widgets-display-syncexec.html private class dosomething implements runnable { public void run() { try { thread.sleep( 500 ); } catch( interruptedexception e ) {e.printstacktrace();} if( !shell.isdisposed() ) { display.syncexec( new runnable() { public void run() { drawshit( display ); } }); } } } } the syncexec() calls in dosomething causing dead lock. if replace syncexec() asyncexec() thread pool shut down fine. there specific reason why use syncexec() ? alternatively should able run shutdown code separate thread

Ecommerce data using Google Analytics/Google tag manager -

is possible setup ecommerce data particular set of products. have store , contains products different vendors. enable particular vendors ecommerce data. goal is, vendor can see ecommerce data not others product information. possible using google analytic or google tag manager if have google tag manager in place possible load different ga profiles depending on vendor id, while having overall ga account own benefit. way can give each vendor it's own ga profile. this require able pass vendor id google tag manager ecommerce platform. within google tag manager setup necessary rules.

python - Import Basemap fails under Fedora 21 -

i installed python-basemap , python-basemap-data (and dependencies, e.g. pyproj) unable import basemap in simple python program, because of error: $ python mapper.py traceback (most recent call last): file "mapper.py", line 4, in <module> mpl_toolkits.basemap import basemap file "/usr/lib64/python2.7/site-packages/mpl_toolkits/basemap/__init__.py", line 30, in <module> mpl_toolkits.basemap import pyproj file "/usr/lib64/python2.7/site-packages/mpl_toolkits/basemap/pyproj.py", line 241, in <module> raise ioerror(msg) ioerror: proj data directory not found. expecting at: /usr/lib64/python2.7/site-packages/mpl_toolkits/basemap/data i tried solution (replacing code snippet) here: get pyinstaller import basemap , not work either. have suggestions? in fedora 20, /usr/lib64/python2.7/site-packages/mpl_toolkits/basemap/pyproj.py had line: pyproj_datadir = '/usr/share/basemap' in fedora 21 data direct

r - Values of the wrong group are used when using plot() within a data.table() in RStudio -

i want generate divided diagram. on upper section of diagram values of group a , on lower 1 values of group b should used. using data.table() this. here code used generate example , set graphical output: library(data.table) set.seed(23) example <- data.table('group' = rep(c('a', 'b'), each = 5), 'value' = runif(10)) layout(1:2) par('mai' = rep(.5, 4)) when running following lines in usual r console correct values used plotting. when running same code in rstudio values of second group used both diagrams: example[, plot(value, ylim = c(0, 1)), = group] # example 1 example[, .sd[plot(value, ylim = c(0, 1))], = group] # example 2 when adding comma in subset data.table .sd[] of example 2 correct output generated in rstudio well: example[, .sd[, plot(value, ylim = c(0, 1))], = group] # example 3 when using barplot() rather plot() rstudio uses correct values well: example[, barplot(value, ylim = c(0, 1)), = group] # example 4

python - Error importing class in django -

i have django app called customer. inside customer.models have model classes 1 of them tooth. created new python file inside app's directory called callbacks.py store callback functions signlas. following from customer.models import tooth def callback(sender, **kwargs) #using tooth here and on models.py from customer.callbacks import callback #..... post_save.connect(callback, sender=customer) but when try run sqlall import error customer.models import tooth importerror: cannot import name tooth everything else other imports work normally. edit: using django 1.6 version this circular import. here's happens: django loads models therefore, django imports customer.models python execute content of customer/models.py compute attributes of module customers/models.py imports customer/callbacks.py python set aside execution of customer/models.py , starts executing customer/callbacks.py callbacks.py try import models.py being imported.

extendscript - Apply mask to an image in Photoshop script -

i need create photoshop script (i'm using java script) takes few images , applies same mask of them. ( here mean applying mask ) once i've loaded images using code var sourceimagedoc = app.open(new file("./image.png")) var maskimagedoc = app.open(new file("./mask.png")) how can set maskimagedoc mask sourceimagedoc ? here snippets out of 1 of scripts works cs3 +. can see uses ugly script listener code - if you're applying layer rather group, may need adjust part? i'm not sure remember ever using function on layer rather layerset. //mask group paper area app.activedocument.activelayer = lyr; selectrasterlayercontents(); app.activedocument.activelayer = grp; addmasktogroup(); //selects contents of active layer. function selectrasterlayercontents() { var id47 = charidtotypeid( "setd" ); var desc11 = new actiondescriptor(); var id48 = charidtotypeid( "null" ); var ref11 = new actionref

Merge CSV files with dynamic headers in Java -

i have 2 or more .csv files have following data: //csv#1 actor.id, actor.displayname, published, target.id, target.objecttype 1, test, 2014-04-03, 2, page //csv#2 actor.id, actor.displayname, published, object.id 2, testing, 2014-04-04, 3 desired output file: //csv#output actor.id, actor.displayname, published, target.id, target.objecttype, object.id 1, test, 2014-04-03, 2, page, 2, testing, 2014-04-04, , , 3 for case of might wonder: "." in header additional information in .csv file , shouldn't treated separator (the "." results conversion of json-file csv, respecting level of json-data). problem did not find solution far accepts different column counts. there fine way achieve this? did not have code far, thought following work: read 2 or more files , add each row hashmap<integer,string> //integer = linenumber, string = data , each file gets it's own hashmap iterate through indices , add data new hashmap. why think thought not goo

android - Twitter's Fabric SDK import in gradle freezes AndroidStudio -

don't know if androidstudio bug, fabric problem or configuration problem. because androidstudio freezes cannot access debug log error message. executing ./gradlew build command line fails. caused by: org.gradle.api.unknowntaskexception: task path 'testdebugclasses' not found in project ':app'. @ org.gradle.api.internal.tasks.defaulttaskcontainer.getbypath(defaulttaskcontainer.java:150) @ org.gradle.api.internal.tasks.defaulttaskcontainer.resolvetask(defaulttaskcontainer.java:144) @ org.gradle.api.internal.tasks.defaulttaskdependency.resolve(defaulttaskdependency.java:80) @ org.gradle.api.internal.tasks.cachingtaskdependencyresolvecontext$taskgraphimpl.getnodevalues(cachingtaskdependencyresolvecontext.java:86) @ org.gradle.internal.graph.cachingdirectedgraphwalker$graphwithempyedges.getnodevalues(cachingdirectedgraphwalker.java:200) @ org.gradle.internal.graph.cachingdirectedgraphwalker.dosearch(cachingdirectedgraphwalker.java:112) @ org.gradle.internal.graph.

c# - Windows phone 8.1 GeoLocator GeoPositionAsync not working unless in code behind -

i spent several hours researching , trying various things solve apparently common issue in 8.1 sdk geolocator.getgeopositionasync call never returns or falls threw exception throws (per google search) ex.hresult == 0x80004004. after doing digging, noticed error silently hidden inside desiredaccuracyinmeters if not set. even after this, way able work placing code inside code behind of windows phone view trying have call method inside button click. starting think there threading issue don't understand? i'm not great @ ui threads , that, think using proper usage of async , await follow way back. here code. geolocator.getgeopositionasync method inside phone extension library created nd class looks this: public class placefinder : iplacefinderprovider<maproute> { private dictionary<string, bool> settings = usersettingsprovider.getsetting<bool>(new list<string>() { "hasuserconsent" }); public async task<geolocationmodel> get

requirejs - Exclude shim from require js optimized build -

i've durandal webapp uses require js load modules. there's shim configured tinymce. works ok when using non-optimized version. when use r.js optimize code, want exclude tinymce bundle, it's included. know how exclude shims being included in optimized build? i'm using gulp-durandal, , i've excluded other modules, using excludeshadow setting, doesn't seam work shims, or i'm doing wrong. edit: managed fix problem manually setting in gulp-durandal file exclude array in rjsconfigadapter. reason modulefilter function didn't excluded files, exclude array did job try paths.tinymce=empty: in r.js command line call. or (in require config), if use via grunt.js or something: paths: { tinymce: "empty:" }

MATLAB GUI User Input Update -

i have matlab gui takes values user input , calculation based on , plot them in gui. everything right , working when change values in gui not plot expected , gives , error of dimension mismatch. however, there no dimension mismatch , if go script , press run again (the big green arrow) , click plot again, plots values expected. i have initialized of values use can not see how can fix this. need update command of script each time press 'plot' button. any appreciated, many thanks!.. code: a = str2double(get(handles.edit14,'string')); b = str2double(get(handles.edit15,'string')); c = str2double(get(handles.edit16,'string')); d = str2double(get(handles.edit18,'string')); e = str2double(get(handles.edit19,'string')); f = str2double(get(handles.edit20,'string')); veff=[a:b:c] %user input speeds (a,b,c) (comes user) q = 0.5*1.225*(veff*1000/3600)^2; f1=q*s; m1=q*s*cref; fx1=(f1*coef(:,1)); fz1=(f1*coef(:,3)); mm1=(m1*co

wro4j - Error while creating ro.isdc.wro.extensions.manager.ExtensionsConfigurableWroManagerFactory -

currently working in web app proyect involves java, javascript, css (compass). trying configure runtime solution merges *.js , *.scss single file. following guidelines explained in wro4j site still following error: 2014-12-16 12:59:00,154 [http-bio-8080-exec-2] error ro.isdc.wro.extensions.model.factory.smartwromodelfactory - using xmlmodelfactory model creation.. [fail] model creation using xmlmodelfactory failed. trying ... [fail] exception occured while building model using: xmlmodelfactory cannot build model xml using groovymodelfactory model creation.. [fail] model creation using groovymodelfactory failed. trying ... [fail] exception occured while building model using: groovymodelfactory invalid model found! using jsonmodelfactory model creation.. [fail] model creation using jsonmodelfactory failed. trying ... [fail] exception occured while building model using: jsonmodelfactory invalid model found! 2014-12-16 12:59:00,155 [http-bio-8080-exec-2] error ro.isdc.wro.model