Posts

Showing posts from January, 2012

java - Change Tooltips with Nimbus -

i'm trying change globaly size of tooltips. i'm using : uimanager.put("tooltip.font", new font("sansserif",font.plain,25)); which work fine in general. in case, i'm using nimbus laf code : uimanager.lookandfeelinfo plafinfo[] = uimanager.getinstalledlookandfeels(); boolean laffound=false; int lafindex=0; (int = 0; < plafinfo.length && !laffound; look++) { if(plafinfo[look].getclassname().tolowercase().contains("nimbus")) { laffound=true; lafindex=look; } } try { if(laffound) { uimanager.setlookandfeel(plafinfo[lafindex].getclassname()); } else {uimanager.setlookandfeel(uimanager.getcrossplatformlookandfeelclassname());} } catch(exception e){logger.getlogger(fenetre.class.getname()).log(level.severe, null, e);} //correct tooltips size uimanager.put("tooltip.font", new font("sanss...

tuple in redis / python: can store, not retrieve -

so, i've got redis working python -- exciting! i need store tuple , retrieve / parse later. construct below isn't working, think because returned tuple quoted -- there quote on either end of it. it seems me quotes indicate isn't tuple, rather string. so know how redis return working tuple? thanks! >>> tup1 = ('2011-04-05', 25.2390232323, 0.32093240923490, 25.239502352390) >>> r.lpush('9999', tup1) 1l >>> r.lpop('9999') "('2011-04-05', 25.2390232323, 0.3209324092349, 25.23950235239)" >>> v = r.lpop('9999') >>> test=v[0] traceback (most recent call last): file "<stdin>", line 1, in <module> typeerror: 'nonetype' object has no attribute '__getitem__' you have popped , element v , element trying retrieve no longer exists. try this: >>> tup1 = ('2011-04-05', 25.2390232323, 0.32093240923490, 25.2395023...

How to receive python's array in function -

how receive array (like numpy ones) function? let's array a = [[2],[3]] , function f . tuples works this: def f((a ,b)): print * b f((2,3)) but how arrays? def f(#here): print a*b f([[2],[3]]) tuple unpacking in function arguments has been removed python 3, suggest stop using it. lists can unpacked tuples: def f(arg): [[a], [b]] = arg return * b or tuple: ((x,), (y,)) = but use indexes: return arg[0][0] * arg[1][0]

ios - Refresh UISplitViewController after changing the Master's width -

i using ios 6.0. this post , know use [splitviewcontroller setvalue:[nsnumber numberwithfloat:10] forkey:@"_mastercolumnwidth"]; to change width of master view.(i not need upload app appstore). but found works in appdelegate , before [self.window makekeyandvisible]; for example, not work in masterviewcontroller viewdidload method i guessed because splieviewcontroller not reloadview after changing "_mastercolumnwidth" property. should next if want change master column width in masterviewcontroller ? could please throw light on issue? thanks in advance. this works me: [splitviewcontroller.view setneedslayout]; i use show/hide masterviewcontoller in landscape mode.

c# - How to put green tick or red cross in winforms? -

Image
is there way can put green tick or red cross besides label in windows forms? need show if configuration success or not. using c#. thanks. pretty easy do. you can add both images, or labels i'm using in example, beside text label , toggle manually visible property. in example, i'm using button click show tick/cross : private void button1_click(object sender, eventargs e) { lblcheck.visible = false; lblcross.visible = false; if (checkconfiguration()) { lblcheck.visible = true; } else { lblcross.visible = true; } } in designer, lblcheck label containing unicode character ✓ (\u2713) color set green, , lblcross label containing x color set red, @ same spot. or, can go 1 label , change text & forecolor property dynamically, : lblverif.text = string.empty; if (checkconfiguration()) { lblverif.text = "✓"; ...

website - MODx - Php code isn't updating -

i have been using snippets power "server status" page minecraftservers, , working fine quite while, reason php code not updating! (it became clear when our servers went down, , sadly server status snippets not updating, , quite few of our users getting confused!) if receive help, awesome- problem : php snippets not updating (not after 24 hours) desired result : is there way make update every 2-3 minutes when being used, if no 1 goes page, not update @ all..? snippet code: on pastebin modx version - revolution 2.2.6-pl this due caching. caching in modx means system creates individual file each resource in site. these files built snippets, chunks , placeholders may have in template , elements being parsed. if chose cache these snippets or chunks, modx not call code again, output content generated first time cache created. these cached: [[mysnippet]] [[$mychunk]] these uncached: [[!mysnippet]] [[!$mychunk]] please note want use cachin...

css - Clicking outside jQuery selecter still activates function -

follow these steps @ js riddle see problem: goto http://jsfiddle.net/mjrfc/1/ in result area click word "test" opens point 1 you should able click word test(point1) , word hey(point2) if click h1 tag says hello goes point 1. the code below <div class="contentb"> <h1>testing hello world</h1> <div class="point1">test</div> </div> point1 = '<div class="contentb"> <h1>hello</h1><div class="point1"> test</div><div class="point2">hey</div><h1>world</h1></div>'; point2 = '<div class="contentb"> <div class="point1"> test</div></div>'; var classname = "broken"; $(document).on('click', '.contentb [class]', function () { $(this).fadeto(250, 0.25, function () { clas...

cocoa touch - How to compare two times in iOS -

i trying compare 2 times in ios. have list of times in array want check current time matching 1 array value. can how that. searched whole internet did't idea. i saw this question answer can't exact result. according apple documentation of nsdate compare: returns nscomparisonresult value indicates temporal ordering of receiver , given date. - (nscomparisonresult)compare:(nsdate *)anotherdate parameters anotherdate the date compare receiver. value must not nil. return value if: receiver , anotherdate equal each other, nsorderedsame receiver later in time anotherdate, nsordereddescending receiver earlier in time anotherdate, nsorderedascending in other words: if ([date1 compare:date2]==nsorderedsame) ... note might easier read , write : if ([date2 isequaltodate:date2]) ...

c# - SqlDatareader Has Rows with Multiple Result Sets -

i have result sets in there 3 results. first result set has no rows , next result sets has rows. how check if each result sets has rows? when tried saying false reader.hasrows //this returns false reader.nextresult() reader.hasrows //this agains returns false result has rows try execute query directly sql see result get. maybe try re-think original query , insert there check empty result set. here sample of datareader multiple result sets: see different code you're using?

android - how to close default gallery programattically? -

i using code intent photopickerintent = new intent(intent.action_pick,android.provider.mediastore.images.media.external_content_uri); photopickerintent.settype("image/*"); photopickerintent.setaction(intent.action_get_content); photopickerintent.addcategory(intent.category_openable); photopickerintent.putextra(intent.extra_local_only, true); startactivityforresult(intent.createchooser(photopickerintent, "image file picker"), 1000); to pick image sdcard within application. this working fine, according requirement need close action_pick chooseractivity myself, when touch outside dialog closed fine... but how can close type of dialog programatically.. anyone pls give me suggestion...... you can't. that chooser separate activity, launched intent (which launch activity via intent when user selects something). you don't control chooser, not in app.

C# - StreamReader/StreamWriter - File used by another process -

first off, made sure dispose , close (both reader , writer) properly. method i'm doing i'm using using statement; , before this, manually used dispose , close method provided both writer , reader. both of these methods won't solve problem. secondly, point i'm suspecting, i'm processing lot of files both reading , writing. further, every time run program, program run deeper list of files supposed processed (ie, have 10 files, first time run program process first 2 before throwing error; second time run program process first 5 before throwing error , on). how supposed fix problem/bug? in advance! edit - code attached public static void fileprocessing(string initpath, string targetpath, string startline) { string line = null; string content = null; string nl = "\r\n"; using (streamreader reader = new streamreader(initpath)) { while (!reader.readline().contains(startline)) ; while...

php - Laravel - Using bundle to retrieve data from db -

first of all, i'm new laravel , mvc environment. project, i'm using mysql database , charisma bundle. i'm having difficulties when trying retrieve data db. wonder if guide me through these problems. if i'm using bundle, put models, controllers , routes? in /application folder, or in bundle's folder itself? when use /application folder, , when use charisma folder? (obviously, i'm using front-end ui) i have record in database table (named user_links ) test data retrieval in charisma view. how go that? i'm using crud tutorial in laravel guide, it's little confusing when comes using bundle. ok, let me try way. i'm going retrieval here. hope can point out mistake , guide me fix.: table name user_links : id: int user_id: varchar link_title: text link_url: text model /application/models/user_links.php (since charisma doesn't have /models folder, i'm gonna use default one): class user_link extends eloquent{ } controller...

3x3 Matrix Rotation in C++ -

alright, first off, know similar questions on web, have looked @ more i'd care count, i've been trying figure out 3 weeks (not constantly, on , off, hoping spark of insight). in end, want get, function pass in how want rotate (currently i'm working in radian's, can go degrees or radians) , returns rotation matrix, preserving translations had. i understand formula rotate on "z" axis in 2d cartesian plane, is: [cos(radians) -sin(radians) 0] [sin(radians) cos(radians) 0] [0 0 1] i understand matrix maths (addition, subtraction, multiplication , determinant/inverse) well, i'm not understanding, how to, step-by-step, make matrix can use rotation, preserving translation (and whatever else, scale) has. from i've gathered other examples, multiply current matrix (whatever may be, let's use identity matrix now), matrix this: [cos(radians) - sin(radians)] [sin(radians) + cos(radians)] [1] but origina...

iphone - scroll table view on selecting a textfield -

i have tableview text field on each cell problem tableview should scroll on selecting text field.here i'm attaching project can u please let me know mistake had made. here link u can download here http://pastelink.me/dl/9c2f89 code have used scroll up. [super viewwillappear:yes]; uitableviewcell *cellc = (uitableviewcell *)[[textfield superview]superview]; [tabcontroller scrolltorowatindexpath:[tabcontroller indexpathforcell:cellc] atscrollposition:uitableviewscrollpositiontop animated:yes]; look @ project here add class project , try use it may work(tpkeyboardavoidingtableview .h/tpkeyboardavoidingtableview .m).

user interface - What is List Controls? -

while reading 1 of selenium books, came across following statement: "the selenium webdriver provides select class working dropdown or list controls." but didn't understand, "list controls" element? could explain me or point me url (something http://en.wikipedia.org/wiki/drop-down_list drop-down list)?

cocos2d iphone - Disallow orientation in a certain CCLayer only -

globally game supports 2 orientations: landscape right , landscape left in 1 subscreen (inheriting cclayer) need lock current orientation ... current orientation locked... when user pops screen (cclayer), orientation should work freely again. i did this: edit appdelegate.h, add mask locking orientation: @interface mynavigationcontroller : uinavigationcontroller <ccdirectordelegate> @property uiinterfaceorientationmask lockedtoorientation; @end in appdelegate.m, synthesize mask, , replace 2 functions: @synthesize lockedtoorientation; // assign -(nsuinteger)supportedinterfaceorientations { if (!self.lockedtoorientation) { // iphone if( [[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone ) return uiinterfaceorientationmasklandscape; // ipad return uiinterfaceorientationmasklandscape; } else { return self.lockedtoorientation; } } // supported orientations. customize ow...

cordova - Why do I need a server to develop a phonegap app -

i'm new phone gap development, documentation says following: specifying server url the prepackaged phonegap files shipped profound ui include file named app.js, serves main configuration file profound ui application. first step point app.js server. @ top of file, find following line: pui.serverurl ="http://your_ibmi_server"; what's ibmi server , why need one? the phonegap documentation on official site had tweaks when visited , had take other resources . tells basic things . here how phonegap works , phonegap creates workspace can port html5 app other platform , you'll need create workspace using shell commands (command prompt ) , connect ide (like ecllipse ) , there js library provided cordova.js give functions interact device(like android phone) you're working on accessing camera etc . no server side work till need ,you can use js send data server , want option . hope helps.

how to pass parameter into Files section in Inno -

i've googled lot not find answer on question. how correctly pass parameter function this: getpath('myparam')? i have such code: [files] source: "appname\*"; destdir: "{code:getpath('myparam')}"; [code] function getpath(param: string):string; var objregexp: string; path: variant; begin path := expandconstant('{userappdata}') +'\adobe\' + param + '\.+'; objregexp := createoleobject('vbscript.regexp'); objregexp.pattern := '(.+(\\version )?( cs)?\d.+)'; if objregexp.test(path) begin objregexpmatches := objregexp.execute(path); result := objregexpmatches.item[0].value; end; end as it's shown in the reference , prototype of scripted constants looks this: {code:functionname|param} so need add | char after function name , remove parentheses single quote marks scripted constant function call. in pseudo-code might this: [files] source: ...

python merge sort implementation results in nested lists -

i'm attempting implement merge sort in python #!/usr/bin/python import math def merge_sort(unsorted): if(len(unsorted)<2): return unsorted middle = int(math.floor(len(unsorted)/2)) left = merge_sort(unsorted[0:middle]) right = merge_sort(unsorted[middle:]) return merge(left, right) def merge(left, right): results = [] while (len(left) > 0 , len(right) > 0 ): if(left[0] < right[0]): results.append(left.pop(0) ) else: results.append( right.pop(0)) if (len(left) > 0): results.append(left) if (len(right) > 0): results.append(right) return results print merge_sort(list('7123')) however result looks [['1'], ['2'], ['3'], [['7']]] instead of ['7', '1', '2', '3'] . what's error in syntax? use list.extend here: if (len(left) > 0): results.extend(left) if (len(ri...

Fieldset in system configuration - Magento Admin module -

i creating admin module. have set of fields , want create fieldset each of 3 fields in system configuration, have created fields wanted add fieldset in it. appreciated. thank you you haven't given information i.e layout of module, whether adding fields in code or .phtml how adding fields field set: protected function _prepareform() { $form = new varien_data_form(); $this->setform($form); $fieldset = $form->addfieldset('form_settings', array('legend'=>mage::helper('mymodule')->__('module settings'))); $newfieldset = $fieldset->addfieldset('form_settings_test', array('legend'=>mage::helper('khaosconnect')->__('order settings'))); $newfieldset->addfield('mysetting1', 'text', array( 'label' => mage::helper('mymodule')->__('setting 1'), 'class' => 'required-entry', ...

html - Mozilla Firefox form values reset on history.back -

i'm writing php script. i've got form uses post method , action page. if error occurs, show message on target page, , let user go via link triggers history.back(); javascript function. user clicks link , turns page includes form , values entered user should remain in inputs. they stay on chrome, lost in firefox. there way keep dom information on major browsers using history, or way use cache session, cookies, etc. ? you could, , know it's annoying, capture post data , turn session variables, repopulate input fields on browser back. alternatively, can submit form iframe , process, or use ajax process , depending on result, trigger new page load or not.

postgresql - How to connect Pgadmin3 to a database on Virtualbox machine? -

i have ubuntu server postgresql server on virtualbox machine (which runs on local machine), , pgadmin3 on local machine. how can connect pgadmin3 database on virtualbox? getting "server doesn't listen" postgres running inside virtualbox. found out. make work, did: 1) edited file /etc/postgresql/9.1/main/postgresql.conf , uncommented , edited 1 line contain: listen_addresses = '10.10.4.14,localhost' where 10.10.4.14 address used access server on virtualbox. 2) edited file /etc/postgresql/9.1/main/pg_hba.conf , added 1 line @ end: host 10.10.4.14/24 md5 note file path in case might different if postgres version not same mine, or linux distribution might place files in other locations.

php - Joomla K2 - Get article link (SEF) by ID -

how can retrieve sef link of article id? i think thing this: $link = get_link(34); // 34 article id <a href="<?php echo $link; ?>">article link</a> update code (updated rikesh code): mysql query: "select id, title, extra_fields xxxxx_k2_items catid = ".$catid $n=0; //counter while($row = mysql_fetch_array($result)){ $titles[$n] = $row['title']; $links[$n] = jroute::_(contenthelperroute::getarticleroute($row['id'], $catid)); $n++; } ok, retrieves links /joomla/index.php/currentpage?id=4 4 correct id link doesn't work! goes wrong page. doubt is: code works k2 articles? because i'm working k2 articles not default joomla articles. edit: yes, i've checked doubt, code links joomla articles id, ids i'm using k2 articles! notice: i'd need of sef link you should include k2 route require_once(jpath_site.ds.'components'.ds.'com_k2'.ds.'helpers'.ds.'route.php...

openframeworks - saving kinect reconstructed 3d view into a file -

Image
i'm going run project; reconstruct room kinect. in format 3d reconstructed view saved ? could save or convert 3dm, 3ds, max, obj , etc ? thanks! you can save 3d coordinates ply format . here's basic example using ofxkinect: void exportplycloud(string filename, ofmesh& cloud) { offile ply; if (ply.open(filename, offile::writeonly)) { // write header ply << "ply" << endl; ply << "format binary_little_endian 1.0" << endl; ply << "element vertex " << cloud.getvertices().size() << endl; ply << "property float x" << endl; ply << "property float y" << endl; ply << "property float z" << endl; ply << "end_header" << endl; // write vertices vector<ofvec3f>& surface = cloud.getvertices(); for(i...

Regex match string conditions -

since i'm not @ regex how can match conditions in string, staticstring_1number:1number:more 1number . example: string_3:0:12344555 - match string_s:0:12344555 - no match string_3:s:12344555 - no match string_3:0:123s4555 - no match thanks. if understand pattern staticstring_1number:1number:more 1number correctly regex match against such strings following: '^[a-za-z]+_[0-9]:[0-9]:[0-9]+$' or if environment support character classes: '^\w+_\d:\d:\d+$'

workflow - BPMN in WSO2 ESB -

i want use bpmn in wso2 esb, unfortunately seems wso2 esb not support bpmn , support bpel. there way integrate bpmn engine such activiti or jbpm or else wso2 esb? you might want @ intalio|bpms. creating valid bpel process bpmn diagram.

php - How reduce mysql cpu usage In the below case -

i creating campaign tracking site. having 100 of tables. creating new table each month logging searches , clicks using create table if not exists (the table consists of 23 fields , 9 indexes.). client complaining query telling hogging alot of cpu. it’s running on every request. creating table if it’s not exist ie, once per month. increase cpu usage? if yes ,is there way reduce cpu usage in case? edit 1 create table if not exists click_log_201305 ( hit_id int(10) unsigned not null auto_increment, link_id int(11) not null default '0', word varchar(225) not null default '', ppc_engine varchar(40) not null default 'internal', ppc_commission varchar(10) default null, gross_price decimal(5,3) not null default '0.000', price decimal(5,3) not null default '0.000', hit_date...

c# - How to draw arc with radius and start and stop angle -

if have following 4 properties in datacontext of canvas element point center double radius double startangle double endangle can draw arc without code behind? providing custom component turned out best solution. use in code <controls:arc center="{binding path=previousmousepositionpixels}" stroke="white" strokedasharray="4 4" snapstodevicepixels="true" startangle="0" endangle="{binding path=deltaangle}" smallangle="true" radius="40"/> smallangle when true render small angle between points irrespective of order of startangle , endangle . when smallangle false arc rendered counter clockwise. the implementation is. using system; using system.collections.generic; using system.windows; using system.windows.documents; using system.windows.media; using system.windows.shapes; public sealed class arc : shape { ...

objective c - RestKit - Automatic entity mapping -

i'm trying use restkit perform automatic mapping of given entity class name, without having define fields manually. example, imagine managed object called product fields: id , name , type . entity on default store. i need list of products url http://machin.net/products rkentitymapping *map = [rkentitymapping mappingforentityforname:@"product" inmanagedobjectstore:[rkmanagedobjectstore defaultstore]]; question 1 defaultstore not satisfying required store, don't know how specify it. [map addattributemappingsfromdictionary:@{ @"id": @"id", @"name": @"name", @"type": @"type", }]; question 2 can see, i'm using fields , same on source & destination, didn't find way tell restkit use fields of given class. for 1. need configure restkit / core data stack nsmanagedobjectmodel *managedobjectmodel = [nsmanagedobjectmodel mergedmodelfrombundles:nil]; rkman...

c++ - Boost memory_order_consume Example -

i looking @ boost example regarding atomic operations , happens-before relationship, , i'm bit confused. in "happens-before through release , consume" section, there following example erroneous, cannot see : atomic<int> a(0); complex_data_structure data[2]; thread1: data[1] = ...; /* */ a.store(1, memory_order_release); thread2: int index = a.load(memory_order_consume); complex_data_structure tmp; if (index == 0) tmp = data[0]; else tmp = data[1]; boost example here understood (please correct me if wrong): if load operation thread2 precedes store operation thread1 , tmp data[0] . if store operation operation thread1 precedes load operation thread2 , tmp data[ 1 ] because store(1,memory_order_release) thread1 ensure prior writes other memory locations visible thread2 though data[] not computationally-dependent on index. can please clarify error they're talking about? ...

actionscript - Flex NumericStepper: limit range of integer part before the decimal point -

i have numericstepper in flex must accept values between 0 , 999.99. i tried setting numericstepper follows: <s:numericstepper id="numstepper" value="@{myvalue}" maximum="999.99" snapinterval="0.01" stepsize="0.01" minimum="0"/> and setting numbervalidator attached it: var nvalidator:numbervalidator = new numbervalidator(); nvalidator.source = numstepper; nvalidator.precision = 2; numericstepper.maxchars=6; nvalidator.decimalseparator="."; the thing works directly limit user input via keyboard in numeric stepper, user can't type things "1.4567" 1.45. so want limit integer , decimal part of number according specifications: max 3 chars integer part "." decimal separator max 2 chars precision maybe regular expression can help? thanks have tried... nvalidator.fractionaldigits = 2;

linq - Implementing IEqualityComparer<T> on an object with two properties in C# -

i have case need grab bunch of items on distinct, source collection of objects 2 properties, this: public class skillrequirement { public string skill { get; set; } public string requirement { get; set; } } i try collection follows: skillrequirementcomparer scom = new skillrequirementcomparer(); var distinct_list = source.distinct(scom); i tried implement iequalitycomparer<t> this, fell stumped @ gethashcode() method. the class comparer: public class skillrequirementcomparer : iequalitycomparer<skillrequirement> { public bool equals(skillrequirement x, skillrequirement y) { if (x.skill.equals(y.skill) && x.requirement.equals(y.requirement)) { return true; } else { return false; } } public int gethashcode(skillrequirement obj) { //????? } } normally use gethashcode() on property, because comparing on 2 properties, i'm bit @ loss o...

sql server - Replication Snapshot Agent file naming -

when sql server snapshot agent creates snapshot (for transactional replication), there's bunch of .pre, .sch, .bcp, , .idx files, prefixed object name, sequence number , part number. my_table_1#1.bcp my_table. but when table names little longer my_table_is_long can name files my_table_is_lo890be30c_1#1. i want process of these files manually (i.e. grab snapshot , process bcps myself) requires full name of table, , haven't been able find hex number created or stored. don't appear straight object_id, , i've checked various backing tables in distribution , publication databases tables have objid , sycobjid , it's neither of either (after converting hex decimal). does know number comes from? must somewhere. it appears they're random. happens when snapshot generated set of commands placed distribution database (you can see them exec sp_browsereplcmds) , these have hardcoded table name along script names, , in order run them. when run distribution...

database - Cassandra loads data incorrect -

problem: copied data cassandra cluster , want add other 1 noded cluster. when load data column data written row key in database. cassandra version: 1.1.6 i have no clue have done wrong. edit: i copied stored sstables 1 cluster(out of data file directory of cassandra) new cluster. copying mean ctrl-c , ctr-v on windows. when restart cluster after data in columnfamilies looks this: row key columns movelet_{[1014][c2aed5777e365035da700000]:[invoice]:[null]} movelet_{[1014][c2aed57754835035da6d0000]:[invoice]:[100]} movelet_{[1011][0afe012a175e5051b73c2929]:[invoice]:[100]} movelet_{[1011][0afe012a2873505c37b31058]:[invoice]:[null]} movelet_{[1011][0afe012a17645051b7091825]:[invoice]:[null]} movelet_{[1009][c11132380a70501a3e88177b]:[invoice]:[100]} movelet_{[1014][c2aed57754835035e1060305]:[invoice]:[null]} create snapshot, load using sstableloader read more here: http://www.datastax.co...

stream - With dropbox API is it possible to generate a public link? -

i'm wondering if possible generate public link dropbox content api? i'm asking because i'm looking upload videos dropbox remote server , want avoid copy video on local server before upload on remote server. the idea open stream directly dropbox upload video on remote server. possible ? cheers, maxime the api doesn't have sharing features , can't generate public link using it. way generate public link manually.

javascript - Onunload, onbeforeunload - guidance requested -

i have web server generates questions students of particular subject. web server needs keep track of how time each student has spent on particular set of questions. the web pages have "finished" button, which, when pressed, causes statistics sent server. however, want web browser send statistics if student navigates away page or closes browser window without pressing "finished". for purpose, have planned have "onunload" or "onbeforeunload" send ajax request server relevant information. apparently different browsers not support these events, , there restrictions on can done in event handlers. and, of course, don't want browse freeze if communication server fails. so, need advice on best way this. if wanted sure handle "special events" send tick 'requests' webpage server. granularity depends on tracking requirements, load, , whether intranet or internet application; can seconds or minute. tracking time spe...

javascript - using PHP variable within onClick -

i wondering wrong tag using uses php variable within onclick event. after looking around other answers on have tried reason doesnt work. <a onclick="setcartdisplay('<?=$prodid;?>'); return false;" href="prodtest2.php?action=add&id=<?=$id;?>"> here code leading , including link tag doesnt work. $prod_query = 'select * *****.*****'; $prod_details = db_query_into_array_enhanced($mysql_connection, $prod_query); $count = count($prod_details); for($i = 0; $i < $count; $i++) {?> <? $prodid = $prod_details[$i]['catid']; $proddesc = $prod_details[$i]['shortdescription']; $prodprice = $prod_details[$i]['rrp']; ?> <tr> <td><?=$prodid;?></td> <td><?=$proddesc;?></td> ...

android - Disable notification of apps -

whenever there notification in android there led blink until see notification.can disable notification (led blinking) android apps when service running in background. by default notifications created option: .setdefaults((notification.default_all) includes options including default_lights if don't want lights shown set options want. can view settings available here http://developer.android.com/reference/android/app/notification.html while service running part change options notification in example onstartcommand() service , change them default in ondestroy().

from sql query to mysql equivalent -

please, have query in sql select sum(lhd.sasih)-sum(lhd.sasid) sasi,lhd.kartllg kartllg e2013..levizjehd lhd,supersick_db..produkt prod lhd.kartllg=prod.kodfinance group lhd.kartllg i need write it's equivalent in mysql... error: invalid object name 'e2013..levizjehd'. what need translate in mysql query, don't know .. stand in sql. i'd appreciate please. how connect $host="192.168.10.250\\f501"; $uid="sa"; $passval=""; $database="supersick_db"; $objconnect = odbc_connect("driver={sql server};server=$host;database=$database;",$uid, $passval ) or die("connection not established"); thanks! seems referring database name. 'e2013' 1 db , 'supersick_db' another. first contains 'levizjeh' table other 1 'produkt' table. if have both tables inside same mysql can skip name , .. altogether. select sum(lhd.sasih)-sum(lhd.sasid) sasi, lhd.kartllg kartllg lev...

asp.net - jquery fullcalendar with colored events -

i'm new in query , have problem fullcalendar ( http://arshaw.com/fullcalendar/ ). want color events depending on types. js: $(document).ready(function () { $('#fullcal').fullcalendar({ alldaydefault: false, defaultview: 'agendaweek', eventsources: [ { url: 'ws.asmx/getschedulerevents', type: 'post', data: { tasktype: 'todo' }, color: 'red', textcolor: 'black' }, { url: 'ws.asmx/getschedulerevents', type: 'post', data: { tasktype: 'completed' }, color: 'blue', textcolor: 'white' } ...

Django Model Optimization -

class model(models.model): ....... ....... ....... ....... first_name = models.charfield(max_length = 50) last_name = models.charfield(ma_lenghth = 50) def full_name(): return '%s %s' %(self.first_name, self.last_name) calling models.objects.get().full_name() efficient or model.objects.filter().values('first_name, 'last_name') , adding string later better. the question in regards database optimization. want know if calling method of model loads whole object or not. if not feel both result in same database operations if loads whole object values method better optimization. please reply. share experiences if have on topic , statistics comparison if have one. please note example , not actual use case, model contains many other fields. few feel using defer() or only() give desired result. found in django documentation prevents fields data being converted python object , not in sql look-ups. therefore don't think t...

ios - UISwipeGestureRecognizer blocked by UITapGestureRecognizer -

i have view needs handle pan, tap, , swipe gestures. have pan , tap working, when add swipe, doesn't work. curiously, seems tap somehow blocks swipes because if remove tap, swipe works fine. here's how create gesture recognizers. - (void) initgesturehandlers { uiswipegesturerecognizer *swipeleftgesture = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(handleswipeleftgesture:)]; swipeleftgesture.numberoftouchesrequired = 1; swipeleftgesture.direction = uiswipegesturerecognizerdirectionleft; [self addgesturerecognizer:swipeleftgesture]; uiswipegesturerecognizer *swiperightgesture = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(handleswiperightgesture:)]; swiperightgesture.numberoftouchesrequired = 1; swiperightgesture.direction = uiswipegesturerecognizerdirectionright; [self addgesturerecognizer:swiperightgesture]; uitapgesturerecognizer *tapgesture = [[uitapgesturerecognizer alloc] initwi...

joomla - How to load widgetkit shortcode in modules? -

i way load widgetkit in module. example in mod_content. dont want use default joomla! {loadposition #} load widgetkit module in mod_content. i think more straightforward user widgetkit shortcode in module. doesnt work on sites. on sites works. has idea how solve it? thank you. make sure "prepare content" option in basic configuration of module enabled. might want use widgetkit module and content module keep things separate.

oracle - All maven flyway plugins are executed with the last user -

i have 2 oracle users , creating different schema them. mean each schema has different tables, types etc. wanted create both schemas flyway maven plugin, first had 2 maven plugins, tried have 2 separate profiles: <profiles> <profile> <id>database</id> <build> <plugins> <plugin> <groupid>com.googlecode.flyway</groupid> <artifactid>flyway-maven-plugin</artifactid> <configuration> <url>jdbc:oracle:thin:@devdb2:1521:zoomutf</url> <table>schema_updates</table> <outoforder>true</outoforder> <locations> <location>db/callrec</location> </locations> <user>cr_5199_mensik_mvn</user> <password>callrec</password> <serverid>callrec</serv...

mysql - sql query with case/COALESCE statement -

i have query working perfectly.but there situation have join 2 query in case statement.but problem 1 of query in use.so question how add 2 sql in 1 sql my original sql select tc.dentist_id,md.vendor_no,pl.pack_trans_id,tc.agent_dentist,md.company_name,md.contact,md.phone_no,sql1.image_path,sql1.metal_id,sql1.expect_more,sql1.how_long_acquire,tc.check_amt,tc.check_date_sent,tc.check_no tbl_check tc left join tbl_mst_dentist md on tc.dentist_id=md.dentist_id left join tbl_pack_list pl on tc.pack_id=pl.pack_id left join (select image_path,pack_id,metal_id,expect_more,how_long_acquire tbl_metals_list group pack_id )sql1 on tc.pack_id=sql1.pack_id tc.sale_agent_id = '3' , tc.paying_percent !=0 now have add 2 sql statement in above statement if(tc.agent_dentist=a) select sa.* ,sm.state_code tbl_sales_agent sa,tbl_mst_state sm sa.sales_agent_id = '3' , sa.state=sm.state_name else select * tbl_mst_den...

keyboard shortcuts - Disable Chromium Ctrl+T, Ctrl+N, Ctrl+W, Alt+F4, etc on Linux in kiosk mode? -

is there way disable chormium's shortcut keys in linux? i've tried --app , --kiosk flags don't disable shortcuts, can still create new (though unusable) tab ctrl + t , can create new (fully functional) window ctrl + n . also, chromium appears it's own check alt + f4 because though have disabled in window manager close chromium. how disable shortcuts within chromium? window manager matchbox, started xorg + nodm (the default lightdm+openbox system didn't allow me auto-restart session or rid of alt + tab ). this embedded system using node.js in background handle hardware io, need network connection function want ensure users locked out of browsers (the various ctrl + alt + f * shortcuts have been removed, chromium remains in making real kiosk system). alt + f4 isn't major concern (though nice rid of) because when chromium crashes nodm automatically restart , handles alt + f4 reasonably (black screen, flashing white, it's - it's not security...

Why I am running into problems with a PHP Date function on IIS? -

i developing php website trying test on iis hosting have (on sub domain of original website classic asp) the whole page falls down after third line in next snippet: $datestring= requestqs("year") . '-' . $monthnumber . '-01 first day of next month'; $dt=date_create($datestring); $nextmonth = $dt->format('y-m-d'); fatal error: call member function format() on non-object in the php version 5.2.17 date stuff should work right? it's working fine on wamp install. any clues? well, trying convert $datestring in wrong way. try this: $dateformat =requestqs("year") . '-' . $monthnumber . '-01'; $datestring = $dateformat.'first day of next month'; $dt = datetime::createfromformat('y-m-d', $dateformat ); $nextmonth = $dt->format('y-m-d');

c++ - Using Constructor for default member value -

in c++11, can initialize object without using initialization list: class z{ int a=0; int b; z():b(0){} //<-- initialized }; what i'm wondering class types, of these preferable: class z{ std::vector<int>a=std::vector<int>(); //or instead: std::vector<int>a(); int b; z():b(0){} //<-- initialized }; there no need explicitly default initialize a , since default constructed. fine: class z { std::vector<int> a; int b = 0; z() {} //<-- a, b initialized }; note second variant function declaration, not initialization: // function a(), returns std::vector<int> std::vector<int> a(); so should have used is // data member std::vector<int>. default construct it. std::vector<int> a{}; of course, if not want default construction, initialization @ point of declaration handy: std::vector<int> a{0,1,2,3};

java - How to model an enumeration where one constant "behaves" differently? -

i have status label shows message colored border according current status. message can vary (that there can multiple messages error ) clear status different, since should never display message. example usage setstatus(information, "there new cookies in jar."); setstatus(error, "you slow."); setstatus(error, "stop bugging me, slow."); clearstatus(); how can model exceptional state clear ? should remove enumeration? have included enumeration, since clear valid state in except not show message. yet client call: setstatus(clear, "ups, gave message"); what other options there model list of values 1 of equal nature? public class statuslabel { public enum status { clear, information, error; } status status = status.clear; public void setstatus(final status status, final string message) { assert status != status.clear; // set status , show message this.status = status; ...

android looking for onClick handler in ContextThemeWrapper -

in 4.0.3 if using base theme in manifest, appears android trying resolve onclick methods of menu's in android.view.contextthemewrapper class. resolves fine in 4.03+. can take out style in manifest , works , gets resolved. how can onclick methods resolve correctly while using theme? i'm inflating menu in oncreateoptionsmenue() method , that's exception getting thrown. android.view.inflateexception: couldn't resolve menu item onclick handler createnewdoc in class android.view.contextthemewrapper @ android.view.menuinflater$inflatedonmenuitemclicklistener.(menuinflater.java:202) @ android.view.menuinflater$menustate.setitem(menuinflater.java:402) @ android.view.menuinflater$menustate.additem(menuinflater.java:436) @ android.view.menuinflater.parsemenu(menuinflater.java:173) @ android.view.menuinflater.inflate(menuinflater.java:95) @ com.c2crm.c2crm.listactivity.oncreateoptionsmenu(listactivity.java:32...

grails - How do I proxy a production database with a testing database? -

i'm working on grails project has static production database lot of data in it. test application using production data, instead of having clone production database i'd setup proxy database production database. essentially reads of database go way production database while writes stop @ proxy database (preferably h2 database). if row updated came production database row saved proxy database , returned, instead of production's row, on subsequent queries. i'd of transparently application possible. line of thinking i'd need fork hibernate gorm implementation , make support use case. has been done before? there better way? forking hibernate gorm implementation may not idea. stuck in version , have to, somehow, make date original plugin (eg. bug fix, new implementations). maybe custom testmixin allows override all registered domain classes , new implementations of save() , get() , find() , etc can option. can work metaclass override static meth...

facebook graph api - App Notifications API -

i want use api in iphone app app post notification user: https://developers.facebook.com/docs/concepts/notifications/ implemented in app: able correct permission: fb_permission_manage_notifications but not call work: ideas? (i respond:{"data":[],"summary":[]} nsdictionary * params = @{ @"access_token" : [[fbsession activesession] accesstoken], @"template" : @"this test", @"href" : @"www.blabla.com"}; nslog(@"%@",params); nsurl *url = [nsurl urlwithstring:@"https://graph.facebook.com/766042719/notifications"]; afhttpclient *httpclient = [[afhttpclient alloc] initwithbaseurl:url]; [httpclient getpath:@"" parameters:params success:^(afhttprequestoperation *operation, id responseobject) { nsstring* mystring = [[nsstring alloc] initwithdata:responseobject encoding:nsutf8stringencoding]; nslog(@"%@",mystring); } failure:^(afhttpreque...

c# - How Do I Sum Items in the List box? -

i have 2 listbox es, source , destination . destination listbox has items selected user. how sum items in destination listbox ? the destination listbox has 2 data types string (description) , decimal (cost). want sum cost. here xaml code <listbox height="237" horizontalalignment="left" margin="44,191,0,0" name="lstdestination" verticalalignment="top" width="264" grid.columnspan="2" itemssource="{binding source={staticresource myitemlist}}"> <listbox.itemtemplate> <datatemplate> <stackpanel orientation="vertical"> <dockpanel > <textblock fontweight="bold" text="item:" dockpanel.dock="left" margin="5,0,10,0"/> <textblock text="{binding path=resource}" foreground="green" fontweight="bold" /> ...

android - onActivityResult get position -

i have activity shows listview, listview composed textedit , button. button used pick email of contact , put in textedit. the listener of button created in custom array adapter , method i'm calling activity pick contact this: intent intent =new intent(intent.action_pick,contactscontract.commondatakinds.email.content_uri); ((activity) v.getcontext()).startactivityforresult(intent, mainactivity.act_pick_contact_mail); i've created method onactivityresult in activity , can email picked user, don't know wich position button pushed. this code i've written: know how can ? @override protected void onactivityresult(int requestcode, int resultcode, intent data) { //pick email if(requestcode==mainactivity.act_pick_contact_mail){ try{ if(resultcode==activity.result_ok){ uri uri=data.getdata(); cursor emailcur=getcontentresolver().query(uri,null, null, null,null); emailcur.movetofirst(); ...

How to add ssh-keys via GitHub's v3 API? -

i'm trying add ssh key via github's v3 api, doesn't seem working. what i'm doing based on instructions given here . more specifically, i'm using following: key=$( cat ~/.ssh/id_rsa.pub ) title=${key/* } # '/* ' above deletes every character in $key , including last # space. json=$( printf '{"title": "%s", "key": "%s"}' "$title" "$key" ) token=$( cat /path/to/tokenfile ) curl -s -d "$json" "https://api.github.com/user/keys?access_token=$token" when run above, response is: { "message": "not found" } ...and, sure enough, when check in github account, $key not among ssh-keys listed 1 .     what doing wrong?     additional details i same "message": "not found" response if run curl -s "https://api.github.com/user/keys?access_token=$token" if replace -s above -i see that, indeed, returne...