Posts

Showing posts from July, 2013

javascript - Angular JS dialog from Angular UI does not close completely -

i'm in process of closing dialog follows: $state.transitionto('login'); $dialog.close(); but have line/bar sits near top of screen dialog hasn't closed properly. it's it's collapsed o possibility of reopening again. if knows why , how can fixed please reply! thanks! yes indeed should have been calling close on modal instance how can carry on when have: .state('login.authenticate',{ onenter: function($stateparams, $state, $dialog ) { var d = $dialog.dialog({ keyboard: true, backdropclick: true, dialogfade: true, backdrop: false, }); d.open("login/authenticate/authenticate.tpl.html", 'authenticationctrl'); } }); this opens view opens 1 of 2 other views each own module , controller (using ng-boilerplate layout). i configure state again when enter login.authenticate state can nest new modules

Rails 400 and 500 error page in development mode -

i trying display 500 error page whenever exception occurs. below setting in development.rb file config.consider_all_requests_local = false and override method local_request in application_controller.rb file def local_request? false end but still not able display 500 page on local machine in case of exception. tried run app on production mode, still getting same result.however can display 500 web page using ip address.plz are routing them properly? can custom error pages putting in application.rb: # error handling config.exceptions_app = self.routes then in routes.rb file: ## routes exceptions match '/404', to: "static#not_found", as: "not_found" match '/422', to: "static#rejected", as: "rejected" match '/500', to: "static#something_wrong", as: "something_wrong" assuming have "static" contro

sqlite - Unable to serialize custom object activeandroid -

i trying store custom object blob in sqllite db. object field of class extending model. other fields (of primitive types) go in db, custom 1 - null always. @table(name = "data") public class data extends model { @column(name = "number") private int number; @column(name = "blob") private contact blob; ... this how store entity data data = new data(0, new contact(id, name, number)); data.save(); here contact class public class contact { private string id; private string name; private string number; ... i believe typeserializer needed, i've created one. public class contactserializer extends typeserializer { private static final string elements_delimiter = ";"; @override public object deserialize(object asstring) { string[] aftersplit = ((string) asstring).split(elements_delimiter); return new contact(aftersplit[0], aftersplit[1], aftersplit[2]); } @override public class<?> getdeserializedtype() { retur

c# - Can't open folders with spaces -

i have following code read items ftp-server: internal list<ftpitem> openfolder(string foldername) { ftpwebrequest request = createftpwebrequest("ftp://myserver.com", foldername); request.method = webrequestmethods.ftp.listdirectorydetails; list<ftpitem> ftpitems = getftpitemsfromrequest(request); return ftpitems; } private list<ftpitem> getftpitemsfromrequest(ftpwebrequest ftpwebrequest) { list<ftpitem> ftpitems = new list<ftpitem>(); webresponse webresponse = ftpwebrequest.getresponse(); streamreader reader = new streamreader(webresponse.getresponsestream()); string line = reader.readline(); while (line != null) { ftpitems.add(new ftpitem(line)); line = reader.readline(); } reader.close(); webresponse.close(); return ftpitems; } private ftpwebrequest createftpwebrequest(params string[] url) { ftpwebrequest webrequest = (ftpwebrequest)webrequest.create(string.join("/",

Specifiying dataset within a SPARQL query -

in tutorial i'm reading, see can specify dataset separately query, this: dataset field: http://dig.csail.mit.edu/2008/webdav/timbl/foaf.rdf query: prefix foaf: <http://xmlns.com/foaf/0.1/> select ?name { ?person foaf:name ?name . } how specify dataset within query? use from keyword: prefix foaf: <http://xmlns.com/foaf/0.1/> select ?name <http://dig.csail.mit.edu/2008/webdav/timbl/foaf.rdf> { ?person foaf:name ?name . } note: use after select statement

c++ - Convert UTF8 encoded byte buffer to wstring? -

does c++ standard template library (stl) provide method convert utf8 encoded byte buffer wstring? for example: const unsigned char* szbuf = (const unsigned char*) "d\xc3\xa9j\xc3\xa0 vu"; std::wstring str = method(szbuf); // should assign "déjà vu" str i want avoid having implement own utf8 conversion code, this: const unsigned char* pch = szbuf; while (*pch != 0) { if ((*pch & 0x80) == 0) { str += *pch++; } else if ((*pch & 0xe0) == 0xc0 && (pch[1] & 0xc0) == 0x80) { wchar_t ch = (((*pch & 0x1f) >> 2) << 8) + ((*pch & 0x03) << 6) + (pch[1] & 0x3f); str += ch; pch += 2; } else if (...) { // other cases omitted } } edit : comments , answer. code fragment performs desired conversion: std::wstring_convert<std::codecvt_utf8<wchar_t>,wchar_t> convert; str = convert.from_bytes((const char*)szbuf);

mysql - declaring and using variables in a trigger -

i declaring variables in mysql trigger delimiter // create trigger lestrigger after insert on examinations each row begin declare the_last_inserted_id int ; declare the_class_id int; declare the_year_id int; set the_last_inserted_id = last_insert_id(); set the_class_id = select examination_class_id examinations examination_id = the_last_inserted_id; set the_year_id = select examination_class_year_id examinations examination_id = the_last_inserted_id; insert examination_data (ed_cs_id,ed_examination_id) select cs_id class_students cs_class_id = the_class_id , cs_year_id = the_year_id,the_last_inserted_id; end // delimiter ; but keep getting error /* sql error (1064): have error in sql syntax; check manual corresponds mysql server version right syntax use near 'select examination_class_id examinations examination_id = the_last_in' @ line 10 */ is way using variables syntactically right?. use into keyword ht

java - How can I access files in my SRC folder? -

hi ive been trying access image files within src folder can run directly jar. unfortunatly not loading them can please have help. null pointer exception , cannot read input file. here location of folder , put in code. code: "/sprites/mapsheet2.png" directory: c:\users\lucas\workspace\vigilante\src\sprites\mapsheet2.png if info needed tell me , ill send it. resources .jar file can loaded with: getclass().getresource() returns url correct path image icon = imageio.read(getclass().getresource("image´s path"));

Can Tibco HTTP receiver perform 1 PORT and many Operations? -

can tibco bw http receiver perform 1 port , many operations service activity did??? if yes, how configure??? please advice. thanks , weekends. the way have transitions http receiver process starter call process activities, invoke each of operations. in each transition, set condition type success condition , set xpath appropriately.

Google URL Shortner API Setting Service Parameters in C# -

i'm using google url shortner api, https://code.google.com/p/google-api-dotnet-client/wiki/apis#url_shortener_api , , need set quotauser parameter. should do-able via service.serviceparameters dictionary , quotauser key in dictionary, it's read can't set value of quotauser need be. thoughts on how accomplish this? don't see why provide dictionary no way set values in it. each service request contains quotauser property, can set want. example in following sample code: var service = new urlshortenerservice(new baseclientservice.initializer() { authenticator = auth, applicationname = "put_here_your_app_name", }); // code here... // create request set quota , execute var request = service.url.list(); request.quotauser = "put_here_your_quota" urlhistory result = request.execute(); take in our urlshortenerservice sample here full sample how use urlshortener service (i added quota

css - Foundation: Section + Clearing -

Image
clearing works fine, "photo" tab of section remains on photo . i've used examples code sections: http://foundation.zurb.com/docs/components/section.html clearing: http://foundation.zurb.com/docs/components/clearing.html rails 4.0.0 solved in way. knows better? app.css .section-container.auto > section.active > .title, .section-container.auto > .section.active > .title { z-index: 10; }

javascript - Either postMessage or addEventListener not working -

the following javascript code uses html5 postmessage / addeventlistener functions send message itself: window.addeventlistener('testmsg', function(event) { alert('got message'); /* never happens. why? */ }, false ); window.addeventlistener('load', function(event) { alert('sending message'); window.postmessage('testmsg', '*'); }, false); a corresponding fiddle: http://jsfiddle.net/zgvlg/3/ the message never received. reason? i have modified fiddle. listening wrong event. fiddle should be window.addeventlistener('message', function(event) { alert('got message'); /* never happens. why? */ }, false ); window.addeventlistener('load', function(event) { alert('sending message'); window.postmessage('message', '*'); }, false);

php - Nested array to 3-level unordered list -

i have nested array, , looking turn unordered list: [2009] => array ( [show name 1] => array ( [0] => class 1 [1] => class 2 ) ) [2008] => array ( [show name 2] => array ( [0] => class 1 [1] => class 2 ) ) and turn into: 2009 show name 1 class 1 class 2 2008 show name 2 class 1 class 2 so far have partially managed it, being able show year, after 'array' show name should be: 2012 array array 2009 array 2008 array i made using following: <ul> <?php foreach( $results $year => $shows ): ?> <li><?= $year ?> <ul> <?php foreach( $shows $show ): ?> <li><?= $show ?></li> <?php endforeach; ?> </ul> </li> <?php endf

c# - Custom httpHeader or soap header into claims-based authorization by endpoint/contract -

i have servicehost implements many contacts on various endpoints , bindings ((http & https) x (rest & soap) anonymous access, windows, or custom authentication, bound depending on contract) & nettcp windows authentication. custom authentication embedded in http or soap headers. each endpoint , contract has purpose. should manageable on single servicehost - don't want split up. i've gotten point endpoints work , serve content correctly, authentication/authorization isn't integrated wcf stack. have been using messageinspector handle validation of authentication header , allowing if token valid. now want integrate authentication/authorization wcf stack. want able access identity , check claims in each operation's implementation. , perhaps basic claims can authorized centrally, "are these claims authorizing @ in contract?" (by contract type). in case of custom authentication, have signed/secure token includes custom implementation of

jquery - ERB iteration not displaying div -

so i've created erb iteration iterates on number of products generates corresponding product image , div (.tagged) lays on top of image. problem when theres 1 out connection (i_connection) no div shown, when there more one, correct number of divs displays. idea what's going on here? <% if @new_manual.present? %> <% @new_manual.steps.each |step| %> <% i_connection = contact.find(step.input_contact) %> <span class="connection" data-pos-x="<%= i_connection.pos_x %>" data-pos-y="<%= i_connection.pos_y %>" data-pos-width="<%= i_connection.pos_width %>" data-pos-height="<%= i_connection.pos_height %>"></span> <% o_connection = contact.find(step.output_contact) %> <% cord = cordtype.find(step.contact_item) %> <%= o_connection.product.full_name %> uses <%= cord.name %> plug <%= i_connection.product.full_name %><

c - Weird behaviour of fifos on linux -

i'm studying linux fifos , made 2 small c programs communicate through fifo. first 1 acts server, receive pattern , executes command using pattern. second 1 acts client, sends pattern , receive result. want server capable of serving multiple requests, not simultaneously, weird thing after first client served stops although put there infinite loop. server.c #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include <signal.h> #include <fcntl.h> void siginthandler(int i){ remove("./fifo1"); remove("./fifo2"); printf("got sigint signal\n"); exit(exit_success); } int main(int argc, char *argv[]){ signal(sigint, siginthandler); int f = mkfifo("./fifo1", 0600); if (f == -1){ perror("unable create fifo1\n"); exit(exit_failure); } f = mkfifo("./fifo2", 0600); if (f == -1){ perror("unable create fifo2\n"

c# - How to change the format of a Date within gridview? -

Image
i'd change date column in gridview dd-mm-yyyy , space time @ end in format of 00:00:00 the name of column thedate , column number 2 i've tried datagridview1[2]["thedate"].tostring("dd/mm/yyyy"); string str = datagridview1[2]["thedate"].tostring("dd.mm.yyyy"); datetime dt = datetime.now; string formated = datagridview1.columns[2].tostring("dd.mm.yyyy"); string formated = string.format("{0:dd.mm.yyyy}", datagridview1.columns[2]); and none of them work i'm not sure go here! i think problem datagridview1[2]["thedate"].tostring("dd.mm.yyyy"); this code not datetime instance. first convert datagridview1[2]["thedate"] datetime use tostring("dd.mm.yyyy"); on it. work.

delphi dynamic sql in delphi 7 -

hello how can prepare dynamic in sql form elemants edit1,edit2,edit3 , datetimepicker1,2 if user cannot select datetimepicker query must select * table if user select datetimepicker buttom question ok user not select edit1 null , edit2 null select edit3 selected how create query adoquery1.close; adoquery1.sql.clear; adoquery1.sql.add('where siptar>='); adoquery1.sql.add(quotedstr(datetostr(datetimepicker1.datetime)+' 00:00:00.000')+' , siptar <='); adoquery1.sql.add(quotedstr(datetostr(datetimepicker2.datetime)+' 23:59:59.000') ); adoquery1.open; i found neccesary code.. adoquery1.sql.clear; adoquery1.sql.add(' select ck.cname,si.rkod,sk.location,sk.sipno,sh.skod,convert(varchar(50),sk.siptar,105)as siptar siparis_kay sk'); adoquery1.sql.add(' left join siparis_har sh on sh.sipno=sk.sipno'); adoquery1.sql.add(' left join cari_kart ck on ck.ckod=sk.carikod'); adoquery1.sql.add(' left join si_gchar si

ruby on rails - Automatic log out in Devise -

i trying make signup form devise using form below <%= form_for :user , url: user_registration_path |f| -%> please add email adderess added our mailing list <%= f.text_field :email %> <%= f.submit "submit", :disable_with => 'submiting...' %> <% end -%> however, devise signing users in automatically. please can advise on how can sign users out automatically when account created without redirecting them sign_out_path or adding sign out link. you override after_signup_path_for(resource) method shown in answer: https://stackoverflow.com/a/5466245/367869 . in method make call sign_out current_user however, agree user136060's comment question - if you're doing mailing list, devise overkill.

javascript - A way to reset mobile browser zoom onSubmit? -

i'm working on interface application requires staying on same page , displaying new message after submitting form. the issue mobile browsers automatically zoom input fields (useful) when users filling out form zoom stay @ level after submission when want return normal , display confirmation message @ standard size. is there way return browser zoom normal javascript (not jquery) without refreshing page? for safari on mobile cant use maximum-scale=1.0 reset maximum-scale=10.0 . make users allowed zoom in x1. reset x10.

php - Does not work markers in prepeared statments -

this question has answer here: table name parameter using pdo/mysql prepared statement 2 answers $dbh = new pdo('mysql:host=' . $_post['db_host'], $_post['db_user'], $_post['db_user_password']); $sql = 'create database :db_name'; $sth = $dbh->prepare($sql); $sth->bindparam(':db_name', $_post['db_name']); var_dump($sth->execute()); it's allways show false. if directly specify db_name, this: $sql = 'create database database'; $sth = $dbh->prepare($sql); $sth->execute(); it work. i'm doing wrong? you can bind data (column values) in parametrized query, not column name , table name. also, in code tried parametrize connection initialization think not correct. you can alternatively depend on white list of db names: $databases = array('dbone', 'dbtwo');

java - Any way to create a URL from a byte array? -

is there way create url byte array? have custom class loader stores entries jarinputstream in hashmap storing entry names bytes. reason i'm looking create url byte array satisfy getresource(string name) method found in classloaders. i've accomplished getresourceasstream(string name) using bytearrayinputstream. assuming use custom classloader , want store/cache bytes of content in hashmap (not location in byte[] form). have same question brought me here. how able solve this: class somelassloader { private final map<string, byte[]> entries = new hashmap<>(); public url getresource(string name) { try { return new url(null, "bytes:///" + name, new byteshandler()); } catch (malformedurlexception e) { throw new runtimeexception(e); } } class byteshandler extends urlstreamhandler { @override protected urlconnection openconnection(url u) throws ioexception {

Using a text file to receive a string for a variable in Python, without defining it -

i have text file in there several variables. of them used in bash script of mine, i'd use same text file python script. lines not formatted python, want script ignore. formatted, want script check , if it's variable i'm looking - use it. import sys import re for ln in open("thefile.txt"): m = re.match(r"(?p<varname>[^=]*)\s*=\s*(?p<value>.+)", ln) if m: varname = m.group("varname") value_string = m.group("value") value = eval(value_string) print value # if variables name thisvariable, value: if varname == "thisvariable": mypythonvariable == value i'm getting following error: nameerror: name 'somevariableinmytextfile' not defined the somevariableinmytextfile first variable in file. my question: do have define every variable in txt file, in order rid o

neural network - Unusual cause of NaN in C++? Do limits approaching zero cause NaN? -

Image
while working on c++ project involves neural networks, hampered nan results. after great deal of tracing (trying find origin of nan), realized source sigmoid derivative function, shown below. double sigder(double n){ return 2*exp(-n) / pow(1 + exp(-n), 2); } although has domain of real numbers, values such -1008.3 caused result of nan. according mathematica, correct result should close 0 - 2.522*10^-438. i've averted issue in following manner: double sigder(double n){ double res = 2*exp(-n) / pow(1 + exp(-n), 2); if( isnan(res) ){ return 0; } else{ return res; } } with simple assumption, code functions expected; however, still don't understand why sigder(<# large magnitude>) not return ~0. please inform me causes of nan in c++ (xcode ide) other dividing 0 , taking root of negative? thanks in advance! i'd know why signer(-1008.3) returns nan , how better/more efficiently trace source of nan values. denominat

html - Multiple Borders with CSS3 with Extended Sidebar -

i want achieve sidebar element background colour continues down page content. have managed add "line" or border located right next sidebar. if @ fiddle, http://jsfiddle.net/mattstrange/brm7r/ <div id="container"> <div id="content">this content</div> <div id="sidebar">lorem ipsum dolor sit amet, consectetur adipiscing elit. aenean lacinia tincidunt nisi @ fermentum. lorem ipsum dolor sit amet, consectetur adipiscing elit. aenean lacinia tincidunt nisi @ fermentum.</div> i "green" background line right next red background sidebar positioned on right. how achieve this? cheers try : #container{ background-color:#9cc; overflow:hidden; width:500px; } #content { width:400px; border-left:100px solid #c33; margin-left:-100px; float:right; display:block; } #sidebar { background-color:#c33; width:100px; border-right:2px solid green; displa

python - Replacing a string with counts of streaks -

let's have string of following form: "000000111100011100001011000000001111" and want create list containing lengths of 1-streaks: [4, 3, 1, 2, 4] is there nice one-liner this? if don't mind from itertools import groupby ... >>> itertools import groupby >>> [len(list(g)) k, g in groupby(s) if k == '1'] [4, 3, 1, 2, 4]

How does Unix/shell scripting work? -

i curious logic of unix environment. i'm under impression unix operating system, shell. subset there more specific shells such bourne, bash, , korn shells. , these shells interpreters , have own functions interpret scripts, , have functions such ping, pwd, etc? there shells within shells? said correct? the unix operating system not shell. a shell program makes easy interact computer running programs , manipulating data streams. the 'functions' mentioned programs, , not part of shell. you can run shell shell if want. example, in bash session , want switch csh something. run csh , when you're finished, exit return bash shell. if like, can run copy of bash inside bash session. might if want modify environment variables , undo changes when return. in these cases, did run program shell , waited terminate. if program happened shell, it's nothing special.

osx - Configure error in Mac OS X Lion 10.7 -- Library 'crypto' is required for OpenSSL -

tried brew install postgres , got following error: datadir=/usr/local/cellar/postgresql/9.2.4/share/postgresql --docdir=/usr/local/cellar/postgresql checking library containing gss_init_sec_context... -lgssapi_krb5 checking library containing com_err... none required checking library containing krb5_sendauth... none required checking crypto_new_ex_data in -lcrypto... no configure: error: library 'crypto' required openssl openssl seems installed correctly (i brew installed it, no complaints, , brew doctor doesn't raise flags it), , xcode developer tools date. looked around how install crypto on mac, (os x lion 10.7), , there surprisingly few resources. ideas what's wrong or how fix it? i tried uninstalling/reinstalling openssl. the problem ended being based on inexplicably empty libcrypto.dylib file. there backup (libcrypto.dylib.bak), , overwrote empty file , problems went away. no idea how happened in first place, if anyone's having similar prob

how to: load drawable icon with app names in android listview -

i wondering how may load drawables or icons applications along app name , activity. looked upon many examples available had no idea how implement them 1 here. if can guide me, great. public void loadapps() { final intent main=new intent(intent.action_main, null); final packagemanager pm = getpackagemanager(); int i=0; int j=0; string tmpnick=""; if(pkg.name.size()!=0 ) {pkg.name.clear(); pkg.activity.clear(); pkg.nick.clear();} switch(checkedradiobutton) { case 0: // lauchables variant of load apps for(i=0; i<pkgextra.name.size(); i++ ) { pkg.name.add(pkgextra.name.get(i)); pkg.nick.add(pkgextra.nick.get(i)); pkg.activity.add(pkgextra.activity.get(i)); } main.addcategory(intent.category_launcher); final list<resolveinfo> launchables=pm.query

html - Xbox Dashboard using CSS "Display" attribute -

i haven't used css's display attribute because tables have been sufficient after deciding practice html again trying recreate xbox dashboard. because dashboard has cells few cells big not think application tables, because div tags being used more , more feel should practice them. leaves me how align cells on side of others such 2 on left , 1 big 1 side of them both, how can this? have tried display attribute of inline-block along combinations of loads of others different cells no success. far code only: <div style="width: 50px; height: 50px; background-color:red;"></div> <div style="width: 50px; height: 50px; background-color:green;"></div> <div style="width: 100px; height: 100px; background-color:blue;"></div> use css float: property arrange divs. in case takes bit of thinking spatially it's not difficult. for example http://jsfiddle.net/2k9tg/ in example divs black borders have no float s

jquery - Javascript Read And Set Two Domains Cookie -

i want do www.foo.com => 2 cookies www.foo2.com => read , set www.foo.com cookies entred foo2.com, reading foo.com cookies , set new cookie foo2.com the platform privacy preferences project ( p3p http://www.w3.org/p3p/ )

wpf - DataGrid custom CanUserAddRows implementation -

i want implement custom add row button datagrid (it's long story). added button in template, , define attached property, , can button's click. can not add new row in generic way -not specified type-. know can similar thing in viewmodel , i'm looking in templates , attached properties. here try; idea complete this? xaml: <style x:key="{x:type datagrid}" targettype="{x:type datagrid}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type datagrid}"> <border x:name="border"> <scrollviewer x:name="dg_scrollviewer" focusable="false"> <scrollviewer.template> <controltemplate targettype="{x:type scrollviewer}"> <grid> <grid.columndef

css - When I use CSS3 scale to zoom an image, the visible area is smaller -

when use css3 scale zoom animage, image's size bigger, can't see whole image. though there scrollbar, can see part of image. click link see demo . var scale = 1; $('img').on('click',function(){ var new_scale = 2 * scale; $(this).css('-webkit-transform', 'scale(' + new_scale +')'); scale = new_scale; }); i'd know how can see whole image after css3 scale. the css transform property affects rendered content of element. if want element's layout occupy more space, you'll need adjust width , height explicitly.

javascript - What is the meaning of White Bar on Chrome Frame Timeline? -

Image
i built application uses smooth scrolling , parallax. found website jerky. able push process uses lower resources , has frame rate below 60 fps. white bar shown on google timeline, animation becoming jerky , useless. what meaning of white bar on chrome? as far understand watching this video , looking @ the docs , white-ish bars load not identified debug tools. did try ruling out external factors chrome extensions?

java - Confused with different methods of creating cookie in HttpClient -

there different methods create cookies in httpclient, confused 1 best. need create,retrieve , modify cookies. for example , can use following code see list of cookies , modify them how create them ? is proper method retrieving them? need them accessible in classes. in addition methods have found require httpresponse, httprequest objects send cookie browser, how if not want use them? code import org.apache.commons.httpclient.cookie; import org.apache.commons.httpclient.httpstate; import org.apache.commons.httpclient.httpclient; import org.apache.commons.httpclient.methods.getmethod; public class getcookieprintandsetvalue { public static void main(string args[]) throws exception { httpclient client = new httpclient(); client.getparams().setparameter("http.useragent", "my browser"); getmethod method = new getmethod("http://localhost:8080/"); try{ client.executemethod(method); cookie[] cookies = client.getstate

ios - Adding gesture recognizer control to JTRevealSideBarDemoV2 -

i using jtrevealsidebardemov2 implementation of side panels facebook , path application. have configured in every sense , want add 1 more feature library. want apply gesture recognizer control in library similar facebook. can help? the link downloading library is:- https://www.cocoacontrols.com/controls/jtrevealsidebar thanks! @wattson:- code have added implementing gesture recognizer. bbut behaving abnormally. if have downloaded code jtrevealsidebardemov2 can analyze code have written for. the code is: (void)setupgestures{ uipangesturerecognizer *panrecognizer = [[uipangesturerecognizer alloc] initwithtarget:self action:@selector(movepanel:)]; [panrecognizer setminimumnumberoftouches:1]; [panrecognizer setmaximumnumberoftouches:1]; [panrecognizer setdelegate:self]; [self.view addgesturerecognizer:panrecognizer]; } -(void)movepanel:(id)sender { [[[(uitapgesturerecognizer*)sender view] layer] removeallanimations];

How to display all categories in magento project -

am new magento 1.7 , using celebrity theme want add categories displayed in left side bar , have browsed through n tried many none of them working (may due celebrity theme). can 1 me on asap. please you can add go layout.xml , add this /app/design/frontend/default/default/layout/catalog.xml open xml file , paste code. <reference name="left"> <block type="catalog/navigation" name="catalog.leftnav" template="catalog/navigation/left_nav.phtml" /> </reference> open file .. /app/design/frontend/default/default/template/catalog/navigation/left_nav.phtml paste code: <?php $obj = new mage_catalog_block_navigation(); $store_cats = $obj->getstorecategories(); $current_cat = $obj->getcurrentcategory(); $current_cat = (is_object($current_cat) ? $current_cat->getname() : ''); foreach ($store_cats $cat) { if ($cat->getname() == $current_cat) { echo '<l

android - Read Barcode with NFC -

i want read barcode using nfc enabled device in android. how achieve this? 1 option read barcode using camera. read using nfc. library provides reading barcode using camera. want read barcode using nfc. did read android documentation nfc ? there descriped how read tags.

Using Excel VBA variable for multiple workbooks -

is possible use 1 variable in excel vba across multiple workbooks? without using add-in approach? mentioned in here . for e.g saving windows user name in var sysuser , want use variable in multiple workbooks, how can that? thanks , best regards ahmed http://www.cpearson.com/excel/trulyglobalvariables.htm this link contains 2 great solutions problem. sure drill down "hidden name" technique's link short , sweet. here's crux of chip's hidden name solution application.executexcel4macro("set.name(""test"",1)") see link full details

Parse an input file into two separate files in java -

i have input file below (for example): 10 12 1 2 ... 9 10 1 2 ... 11 12 the first tells next 10 lines part1 then following next 12 lines part2 . i create 2 separate files part1.txt , part2.txt parsing original input.txt file. how can that? suggestions kindly? using java scanner. solution (partial): worked me based on suggestions below scanner scanner = new scanner(filename); try { string[] first_line = scanner.nextline().split("\\s+", 3); // reading first line of input file int edgecount = integer.parseint(first_line[0]); int vertexcount = integer.parseint(first_line[1]); string hasweight = first_line[2]; while (scanner.hasnextline()) { if(edgecount != 0) { // check whether more edges left read input file scanner edge_scanner = new scanner(scanner.nextline()); .... since sounds homework, not go code detail, read first line, , use .split("\\s+")

windows - setlocal enabledelayedexpansion in batch file -

setlocal enabledelayedexpansion /f "skip=2 tokens=2*" %%a in ('reg query "hklm\software\javasoft\java development kit\1.6" /v javahome') set javapath=%%b setx -m java_home "%javapath%" echo java__path variable: !javapath! echo java__path: %java_home% am setting java home registry. the values getting set. setx working. when try echo using !javapath! , getting value , when tried echo %java_home% , value empty. i tried enabledelayedexpansion no use. how echo %java_home% ?? follow setx set reset local variable. setx -m java_home "%javapath%" set "java_home=%javapath%" if these within loop use !variable! syntax.

ruby - Rails 4 sqlite3 Gem::LoadError -

i keep getting specified 'sqlite3' database adapter, gem not loaded. add `gem 'sqlite3'` gemfile. here's gemfile: source 'https://rubygems.org' ruby '2.0.0' # bundle edge rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.0.0' gem 'thin' # gem 'sqlite3' gem 'mongoid', git: 'https://github.com/mongoid/mongoid.git' gem 'sass-rails', '~> 4.0.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.0.0' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 1.2' group :doc gem 'sdoc', require: false end where else specify adapter? can see sqlite3 excluded gemfile. server restart didn't seem trick. please check database.yml file . might have specified adapter sqlite.

jquery - Checkbox is not selected when click on the button -

i'm trying checkbox before list items in listview. have page listview when click on "edit" button. listview adding checkboxes before list items when i'm clicking on checkbox's page automatically changes previous view (without checkboxes in listview).checkboxes not checked.where i'm doing wrong. $('#fav').on('click', function() { $("#favoriteslist").listview('refresh'); fromstorage(); $(document).on('click', '#empty', function() { $("#favoriteslist").empty(); localstorage.clear(); $("#favoriteslist").listview('refresh'); }); $(document).on('click', '#edit', function() { fromgetstorage(); }); }); function fromgetstorage() { $("#favoriteslist").empty(); $(".ui-listview-filter").remove(); $("#favoriteslist").append('<input type="checkbox" name="

What decimal value does some hexadecimal constant have in Android -

problem in following code, decimal value 0x02 , 0x03 , 0x04 ? hexadecimal numbers? difference when x letter upper case , lower case? code public class certainlibraryclass { public class activityresultcode { public static final int code_a = 0x02; public static final int code_b = 0x03; public static final int code_c = 0x04; } // .... } yes, hexidecimal numbers. case of x not make difference. correct, methods public can called outside of class.

Gsub function issue in Ruby -

i'm attempting create function create prepared statements salesforce queries. requirement escape single quotes; other characters escaped salesforce. when call prepared_query('select id account id = :id , name = :name limit 1', {:id => '00001234', :name => "john 'smith"} the expected output "select id account id = '00001234' , name = 'john \'smith' limit 1" i'm attempting use gsub this. function is def prepared_query(soql, *args) if args[0].is_a? hash args[0].each |key, val| val.gsub!("'", %q(\\\')) soql.gsub! ":#{key}", "'#{val}'" end end end the output "select id account id = '00001234' , name = 'john limit 1smith' limit 1" what causing issue? when use gsub 2 arguments, replacement string interpreted in special way.

How to make function in excel effect to other excel sheet -

now got stuck making function excel can effect other excel sheet in same page. example, have sheet1 , sheet2. have function in sheet1 , want make effect sheet2. input data sheet1 (=b1,c1), effect effect sheet2. wonder how make 2 sheet can commune each other. appreciate. sheets("sheet name") provides reference adjacent sheet. can activate , act on activesheet . or, directly fill cells there.

c# - Getting Data from Form Control in Thread -

having issue getting data form control within thread. need access data, modify it. the following doesn't work i'm aware, used example see i'm trying do. thread t = new thread(() => { foreach (listviewitem row in listview1.items) { row.subitems[0].text = "checking"; thread.sleep(2000); } }); t.start(); i've read msdn documentation on making thread safe calls, can't seem access actual list view control. examples i've seen use delegates "update" controls, need access data in controls before update data in them. edit: i'd see example, or link example, detailing how access listview1 form control in foreach loop. you need use invoke pattern , in order able access any ui element or properties thread other main ui thread. ui controls on windows allways run on main thread, handle message chain correctly between os , ui presented on screen.

facebook - Is there way to know if user is currently playing my application -

i know if user logged app , playing it. besides creating own js code sends heartbeat occasionally, there exists in fb js sdk? no . nothing such exists in fb js sdk...

Android-Change Layout of view dynamically -

i have view in activity : for(int i=0;i<my_newsgroup.size();i++) { view my_updateview=new view(mainactivity.this); my_updateview =layoutinflater.from(mainactivity.this).inflate(r.layout.row2, null); ..... } now want change layout of view dynamically ! how can ? tnx ---------------------------------edit------------------- linearlayout ll2 = (linearlayout)findviewbyid(r.id.parent2); for(int i=0;i<my_newsgroup.size();i++) { view my_updateview=new view(mainactivity.this); my_updateview = layoutinflater.from(mainactivity.this).inflate(r.layout.row2, null); .... ..... relativelayout.layoutparams relativeparams = new relativelayout.layoutparams(layoutparams.fill_parent, layoutparams.fill_parent); ll2.addview(my_updateview,relativeparams); myviewlist.add(my_updateview); } myviewlist : list myviewlist=new arraylist(); and ! example if want hi

php - comparison array doesnt work -

i have code i'm trying compare $current $password array , thought both have same value , doesn't work. $current_password = mysqli_query($db_connection,"select password user username = 'sanket' "); $row = mysqli_fetch_array($current_password); foreach($row $pass) { $password = $pass[0]; } $current = $_post['old_password']; if ($current == $password) { if ($_post['new_password'] == $_post['confirm_password']) { mysqli_query($db_connection,"update user set password = ".$_post['confirm_password']." username = 'sanket'") ; } $row = mysqli_fetch_array($current_password); foreach($row $pass) { $password = $pass[0]; } $row unidimensional array strings. when foreach on $row $pass string. when assign $pass[0] $password , assign first character of string in $pass $password . write: $row = mysqli_fetch_array($current_password

php - PayPal Rest API gives 401 error when switched to Live Credentials -

i creating small website in implemented paypal rest api process credit card checkouts. now problem is working fine using sandbox credentials... gives following error when switch live credentials: fatal error: uncaught exception 'paypal\exception\ppconnectionexception' message 'got http response code 401 when accessing https://api.paypal.com/v1/payments/payment . retried 0 times.' in c:\xampp\htdocs\rest_api_sdk_php\sample\vendor\paypal\sdk-core-php\lib\paypal\core\pphttpconnection.php:99 stack trace: #0 c:\xampp\htdocs\rest_api_sdk_php\sample\vendor\paypal\sdk-core-php\lib\paypal\transport\pprestcall.php(44): paypal\core\pphttpconnection->execute('{"intent":"sale...') #1 c:\xampp\htdocs\rest_api_sdk_php\sample\vendor\paypal\rest-api-sdk-php\lib\paypal\api\payment.php(246): paypal\transport\pprestcall->execute(array, '/v1/payments/pa...', 'post', '{"intent":"sale...') #2 c:\xampp\htdocs\rest_a

java - get select e item in cbx very slow with IE9 -

i need selected text contained in cxb , use function that: return new select(browsercontroller.findelement(by.xpath(webobject))) .getfirstselectedoption().gettext(); it works fine in ff in ie 9 operation terribly slow. i use webdriver +java

asp.net - div with background fixed -

i trying add div html box image in it. couldnt make image stretch div's size here have far, <div style="background:url('images/box.png') no-repeat center center fixed;width:600px;height:400px"> test </div> this displays div width 600px , height 400px displays half of image. need make image stretch. thanks if want image stretch, losing it's original aspect ratio, add background-size: 100% 100%; . on other hand, if want image take entire div while maintaining image aspect ratio , clipping okay, use background-size: cover

c - How to directly insert images and other type of files into SQLITE database as like in mysql and sql by using query? -

how directly insert images , other type of files sqlite database in mysql , sql using query? if not so, there chance in c api programs(only) acquire it? you should use blob type, allows store raw binary data. don't know maximum allowed size, though. create table following: create table `test`.`pic` ( `idpic` integer unsigned not null auto_increment, `caption` varchar(45) not null, `img` blob not null, primary key(`idpic`) ); then read image using standard i/o , write data img column, file.

html - put navigation inside content div -

i seeking correct webpage. if @ html , css posted below, there following unintended behavior: 1) galnavigation seats on content. want is:(if consider box webpage) |-----------------------------------------| |<h2>my gallery</h2> | |here collection of..... | |<gal_navigation> | | | |href garchumuk href falta | | img src img src | | of of | | garchumuk falta | | , on | |-----------------------------------------| 2) also, shown, href should appear @ top of img, not beside. it best, if can done browser independent way. (currently, href appears @ top of img in firefox, not in gnome's epiphany) the codes far have managed: html: <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose