Posts

Showing posts from March, 2014

ruby on rails - Twitter connection timeout -

we launched rails app on heroku , see lot of connection timeouts api. have connection timeout of 10 sec. normal behavior or because of many hits? queries authenticated user. query friends/ids , followers/ids only. we see timeouts in our reverse auth query done same app. do had that? edit having support ticket, told me looking twitter's engineers avoid blacklist. it appears due twitter blacklisting heroku's primary ip addresses. if having issue, please file ticket heroku , comment on twitter discussion: https://dev.twitter.com/discussions/20185

c - ++ Operator on pointers -

my cs course taking bit of turn java c. i'm busy going on pointers @ moment , have come across ++ operator incrementing doens't work when dereferencing. more curiosity question else. not used pointers concept yet. doing wrong or pointers? for example: *pointer++; not increment value. *pointer+=1; increment value. thanks in advance! *pointer++; is equivalent *(pointer++); // pointer incremented and not to (*pointer)++; // pointee incremented

php - Rewrite rules : forgetting a query string in .htaccess -

i have in .htaccess rewritecond %{query_string} ^(.*)?$ rewriterule ^([0-9a-za-z\-_]+)(/)? index.php?action=view&type=page&page=$1&%1 [l] but when put in browser: http://localhost:8888/myapp/test%20doc the url transformed into: index.php?action=view&type=page&page=test why shouldn't get: index.php?action=view&type=page&page=test%20doc ? for readability, remove rewritecond , add qsa (query string append) flag rewriterule : rewriterule ^([\w-]+)/? index.php?action=view&type=page&page=$1 [qsa,l] the url testing ( http://localhost:8888/myapp/test%20doc ) doesn't have query string. mean test with: http://localhost:8888/myapp/test?doc edit you're problem has nothing query strings. fact haven't matched space character in character class , intending to. add space character class. should work you: ^([ \w-]+)/? the \w shorthand 0-9a-za-z_

php - Adding in Module name to template url -

i using modules within codeigniter application , phil sturgeon's template library , i'm trying understand happening when view source code of template. adding on string user name of module. http://mysite.me/index.php/user/assets/globals/bootstrap/css/bootstrap.min.css <!--[if gt ie 8]><!--> <html> <!--<![endif]--> <head> <title><?php echo $template['title']; ?></title> <!-- meta --> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <!-- bootstrap --> <link href="<?php base_url() ?>assets/globals/bootstrap/css/bootstrap.min.css"

css3 - CSS: Opaque overlay with transparent div sections -

i'm developing system site want page turn opaque when activated except divs can receive on. the problem can't figure out how specific divs "appear" transparent on top of opaque background. i tried setting z-index of divs value higher background doesnt seem work. here jsbin illustrating issue. "help" class should appear transparent (i.e. not opaque) http://jsbin.com/ifohuc/1/edit thanks. you must set position attribute of li.help in css file for example position:relative;

ruby on rails - Making query in Objective C using NSRails -

the tutorial video nsrails shows how records , create records. how make query (get request parameters)? nsrails has lot of other documentation, beyond video: github readme github wiki documentation as specifics... the crud tasks laid out in documentation . the github readme displays example in second code block @ top of document: post *postnumber1 = [post remoteobjectwithid:1 error:&error];

jquery - How can I independently detect hover on 2 partially overlapping <div>s? -

my situation this: have 2 partially overlapping divs each have hover effects: div 1 - contains bar chart, bars in have effects on hover. div 2 - area spans bottom 20% of screen , when user hovers on (e.g. near bottom of screen) control slides bottom allow them change global properties table. i want browser independently detect hover on either object, happening whatever object on top detects hover, other not. i've found bunch of related questions, nothing seems answer this. this prototype, hacky answers/answers work in 1 browser (preferably chrome) fine. solutions using css, jquery, or js ok. edit: added fiddle think illustrate problem: http://jsfiddle.net/gkgrx/ so if hover bottom of "table" (big red square turns green on hover), when hit area causes table control slide (which does) table loses hover state - want still detect hover. evidently need cut , paste code here: css: .controlhover { position: absolute; bottom: 0px; left: 0px;

php - Backbone model save state -

i use backbone model save data server. handle success or error callback after save(post) , set wait:true. question why backbone model trigger error callback when server returns string? when server returns json or number, go success. problem if want return multiple error message , want put error message collection(json), never go error callback. sample code like echo 'success'; //actually go error callback cuz return string(any string) echo json_encode($some_array); // go success echo 200/anynumber; // go sucess my solution if wanna return multiple message, can separate message delimiter, , use javascript native function split separate them. there better solution maybe can return state(indicate either success or error) , collection server? model code looks like: somemodel.save({somedata}, { success:function(a,b,c){}, error:function(b,c,d){}, wait: true }); backbone expects json default response format. when integer, suspect, ba

iOS - Is there any way of getting a Low Memory Warning in a Static Library? -

i'm writing static library, , i'd subscribe the uiapplicationdidreceivememorywarningnotification notification. issue notification belongs uiapplication.h, isn't included in project. have no way of receiving low memory warning, since classes extensions of nsobject. any ideas? i've checked out documentation memory management, , none of 3 options work (at bottom). observing uiapplicationdidreceivememorywarningnotification correct approach take. need import uiapplication.h file in order (safely) complete library. if you're compiling multiple architectures (ios & os x) can put conditional sections code import isn't included when isn't appropriate. can weak link uikit .

Is it possible to have an alias for sys.stdout in python? -

consider sample python code. reads stdin , writes file. import sys arg1 = sys.argv[1] f = open(arg1,'w') f.write('<html><head><title></title></head><body>') line in sys.stdin: f.write("<p>") f.write(line) f.write("</p>") f.write("</body></html>") f.close() suppose want modify same program write stdout instead. then, i'll have replace each instance of f.write() sys.stdout.write() . tedious. want know if there way specify f alias sys.stdout , f.write() treated sys.stdout.write() . just do >>> import sys >>> f = sys.stdout >>> f.write('abc') abc now need f = sys.stdout instead of f = open(filename) . (and remove f.close() ) also , please consider using following syntax files. with open(filename, 'r') f: # the file automatically gets closed way.

python 2.7 - Flask web app not responding to external requests on EC2 -

i've got simple flask application i'm hosting on amazon ec2 node , whatever reason can't see externally. flask app here from flask import flask app = flask(__name__) app.config['debug'] = false @app.route('/') def hello_world(): return 'hello world!' @app.route('/p1') def p1(): return "p1!!!" if __name__ == '__main__': app.run(host='0.0.0.0') when run script looks server running fine, in browser (on different computer) put following :5000 (the ip address pull off of aws). what's interesting seems hang, , produces error. guess i'm missing configuration in aws don't know is. appreciated edit tried deploying app on local machine. , when try access browser using localhost:5000, works. when replace localhost ip address, fails was able answer own question, both really the problem having on aws inbound ec2 not allowing access through ports need. when tried running on

php xpath find node with descendant having specific attribute -

i have multi level <ul><li> menu structure. trying top level li has descendant li class of "current-menu-line". my html <ul id="menu1" class="nav"> <li class="menu-item dorment-menu-item"><a href="http://localhost/index.html">welcome</a></li> <li class="menu-item dorment-menu-item"><a href="http://localhost/evidence.html">evidence</a></li> <li class="menu-item dorment-menu-item"><a href="http://localhost/network.html">network</a></li> <li class="menu-item dorment-menu-item"><a href="http://localhost/multi-page-pc-22.html">multi page</a> <ul class="subnav"> <li class="menu-item current-menu-line"><a href="http://localhost/new-page-1-pg-47.html">page 1</a></li> </ul> </li>

Update DataGridView on button Press -

this first windows form/sql application. how update table changes database on submit button press? when trying add 'dt' datatable doesn't recognize it, can't figure out how put button function inside try/catch statement. obviously in 2 functions now, how make work 1 function? code below. using system; using system.collections.generic; using system.componentmodel; using system.drawing; using system.linq; using system.text; using system.windows.forms; using system.data.sql; using system.data; using system.data.sqlclient; namespace accountsapp { public partial class search : form { public search(string searchstring, string searchtype) { initializecomponent(); try { if (searchstring != null) { string strcon = "data source=omiw2310.orthman.local;initial catalog=accts;integrated security=true"; string strsql = "selec

css - I can't make a jQuery UI accordion tab change colors when used (like a:visited), can I? -

i have ol' vanilla jquery ui accordion going. client asked if text on accordion tab (header) change color when been read (visited). although can apply pseudo-class :hover element, far can tell through research, can apply :visited <a> elements. i've done thorough search , come nothing on topic @ all. or asking question wrong? guess there might way write custom jquery this, constrained use jquery ui accordion widget. question jquery ui accordions only. believe answer no. if has idea, i'd grateful. again, accessed accordion tabs (accessed in past, user has moved on), not active accordion tabs. here's standard accordion markup. <div id="accordion"> <h3>research</h3> <div> <p>content here</p> </div> <h3>resources , guides</h3> <div> <p>content here</p> </div> <h3>regulations</h3> <div> <p>content her

jquery - Reading the JSON data -

i trying send data controller view in spring mvc using json, here code in controller: @requestmapping(value="/twitter/searchgeomap", method=requestmethod.get) public string twittersearchgeojson(@requestparam("query") string query) throws twitterexception { list<status> tweets = twitterservice.twittersearchgeo(query); list<string> geolist = new arraylist<string>(); jsonobject json = new jsonobject(); (status tweet : tweets) { geolocation geo = tweet.getgeolocation(); string latitude = string.valueof(geo.getlatitude()); string longitude = string.valueof(geo.getlongitude()); string text = tweet.gettext(); string place = tweet.getplace().tostring(); geolist.add(text); geolist.add(latitude); geolist.add(longitude); geolist.add(place); string key = string.valueof(tweet.getid()); json.accumulate(key, geolist); } return json.tostring();

jquery - html templates in asp net mvc views -

i wondering better approach creating every single view hard coded html. the system creating today has few dozen of views , have manually created tables on it. thinking of creating javascript function build tables passing object parameter containing html properties id, name, class , on. is approach or should stick hard coded mode? i think generic approach lead difficult solution , in case need markup somewhere. if wand use javascript , generate views on client take single page applications , frameworks them such backbone, knockout, angularjs. hth

google maps api 3 - One FusionTableLayer appears to be competing with another -

i have google map 2 fusion table layers, 1 markers , 1 polygons. if display both layers no styling, show up. if style markers, both show up. but, when try style polygons, markers don't show up. i'm out of ideas. // initialize first layer var firstlayer = new google.maps.fusiontableslayer({ query: { select: "'geometry'", from: '1eiyhdpl-5xno7-cswgdrxxyhgfwrljn0jadix9o' }, styles: [{ where: "'abortions' < 100", polygonoptions: { fillcolor: '#cc0000', fillopacity: 0.2 } },{ where: "'abortions' > 100 , 'abortions' < 1000", polygonoptions: { fillcolor: '#cc0000', fillopacity: 0.4 } },{ where: "'abortions' > 1000 , 'abortions' < 10000",

php - multidimensional array duplicates merge -

i have multidimensional array , want combine duplicates same data, example have array fields: array(5) { [0]=> array(2) { ["data"]=> string(10) "05-30-2013" ["link"]=> string() "unions" } [1]=> array(2) { ["data"]=> string(10) "06-03-2013" ["link"]=> string() "potatoes" } [2]=> array(2) { ["data"]=> string(10) "06-03-2013" ["link"]=> string() "apple" } [3]=> array(2) { ["data"]=> string(10) "06-03-2013" ["link"]=> string() "banana" } [4]=> array(2) { ["data"]=> string(10) "05-30-2013" ["link"]=> string() "pear" } } and want combine same dates in one. array(2) { [0]=> array(2) { ["data"]=> string(10) "05-30-2013" ["lin

ruby on rails - RubyMine remote feature -

i'm trying setup rubymine connect on ssh , works , can specify gem command working directory can't figure out how can specify working directory bundler command when runned rubymine. executes command project path windows machine (of course path won't work). tryed export project_path="<project folder>" , it's not working too. in march year feature not supported. dont know if rubymine 6 have feature. link forum

Python 2.7 vs Python 3.3 for Django development -

we starting cloud-based apps based on python + django , have small dilemma. @ first decided go python 3.3, saw lot of libraries/modules have not been ported yet, might have work make sure works python 3.3. given fact projects starting have time frame of few years advice give us? go python 2.7 or python 3.3? thanks in advance! go python 2.7 now. make sure code translates cleanly when using 2to3 . when modules available python 3.x, translate code , run it.

php - Displaying attributes from another model using CGRIDVIEW -

i have 2 tables/models: tmp1 header questiontext tmp2 header part outof i'm trying display columns: header, questiontext, part, outof in single cgridview. in tmp1 model: public function relations() { return array( 'tmp2s' => array(self::has_many, 'tmp2', 'header'), ); } in tmp2 model: public function relations() { return array( 'header' => array(self::belongs_to, 'tmp1', 'header'), ); } controller: public function actionreviewall() { $tmp1 = new tmp1('search'); $tmp1->unsetattributes(); if(isset($_get['tmp1'])){ $model->attributes=$_get['tmp1']; } $this->render('reviewall',array( 'tmp1'=>$tmp1, )); } view: $this->widget('zii.widgets.grid.c

java - Set time to 00:00:00 -

i have problem resetting hours in java. given date want set hours 00:00:00. this code : /** * resets milliseconds, seconds, minutes , hours provided date * * @param date * @return */ public static date trim(date date) { calendar calendar = calendar.getinstance(); calendar.settime(date); calendar.set(calendar.millisecond, 0); calendar.set(calendar.second, 0); calendar.set(calendar.minute, 0); calendar.set(calendar.hour, 0); return calendar.gettime(); } the problem time 12:00:00 , 00:00:00 , when query database entity saved on 07.02.2013 00:00:00 , actual entity time, stored, 12:00:00 query fails. i know 12:00:00 == 00:00:00 ! i using appengine. appengine bug, problem or other issue? or depend on else? use constant instead of calendar.hour , use calendar.hour_of_day . calendar.set(calendar.hour_of_day, 0); calendar.hour uses 0-11 (for use am/pm), , calendar.hour_of_d

c# - Formatting text table in file, merging two lines per row into one -

i'm trying write information text file second row making spaces between lines the code : private void createdriverslist() { streamwriter w = new streamwriter(contentdirectory + "\\" + "drivers.txt"); w.writeline("module name display name driver type link date"); w.writeline("============ ====================== ============= ======================"); //declare, search, , properties in win32_systemdriver system.management.selectquery query = new system.management.selectquery("win32_systemdriver"); system.management.managementobjectsearcher searcher = new system.management.managementobjectsearcher(query); foreach (system.management.managementobject manageobject in searcher.get()) { w.writeline(manageobject["name"].tostring()); w.writeline(" " + manageobject["displayname"].tostring()); } w.close(); } once added line :

asynchronous - Tell user in ios with a Tableview that the most recent call to server did not get any data -

i making call (with afnetworking) server. when data, put array , call refresh screen. far, good. i'm not sure how asynchronous calls server tell user (in, say, cell) there no data display. , when there data display, rid of "no data display" cells. using ios 6.1, support ios 5. if understand correctly, you'd way of showing 'no data display' message if there no results, , replace when data available. my approach display loading indicator (overlaid on table view) user when start loading content (i.e. when first making call server). can have flag on controller tracks whether you're loading data - set yes when start loading, , no when loading completes. while loading, can not display cells in table (assuming have other display show user it's loading). e.g. - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { if (isloading) return 0; //don't display cells while loading if (modelarray.count =

Saving a generated EXCEL file from HTML into the server with ASP -

i have page makes file html download piece of code: response.contenttype = "application/vnd.ms-excel" response.addheader "content-disposition", "attachment;filename=teste.xls" is there way using classic asp save file specific folder in server instead making client download it? you can save file on server in classic asp using scripting.filesystemobject object. here's example making text file: <% dim fs,f set fs=server.createobject("scripting.filesystemobject") set f=fs.createtextfile("c:\test.txt",true) f.write("hello world!") f.write("how today?") f.close set f=nothing set fs=nothing %>

gsp - Grails: How to define a domain property rendered on views but not persisted? -

i have domain classes, let's say: class person { string name integer age //car data needs shown , filled in views //but not persisted in person class string model string color static afterinsert = { def car = new car(model: model, color: color) car.save() } } class car { string model string color } what need show in person views ( create , edit ) model , color properties defined inside person class these doesn't have persisted class. these data, model , color , have persisted using car domain class maybe using afterinsert event. in other words, need save data domain class using views domain class. thanks in advance. you can use transients on properties want gorm ignore, example class person { static transients = ['model', 'color'] string name integer age //car data needs shown , filled in views //but not persisted in person class string model string color .. } just curious there re

java - Spring beans DTD and XMLNS -

when creating spring project have problem xlmns. xmlns? these actually? <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/sch

android - Map overflows onto next tab in ActionBar -

Image
i have action bar set , map displaying on first tab. have disabled scrolling on first tab user can navigate on map. when user presses second tab, there big black square in shape of map , little sliver of previous map overflowing. here pictures. had take 2nd 1 manually because every time took screen shot, black went away reason. code first tab public static class map extends fragment { mapview mapview; googlemap map; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view v = inflater.inflate(r.layout.maptab, container, false); // gets mapview xml layout , creates mapview = (mapview) v.findviewbyid(r.id.mapview); mapview.oncreate(savedinstancestate); // gets googlemap mapview , initialization stuff map = mapview.getmap(); //map.getuisettings().setmylocationbuttonenabled(false); //map.setmylocationenabled(true); map.addmarker(n

c# - XNA Textbox loop -

so im trying make textbox ( not textbox, changing spritefont text ) on xna 4.0 win game heres code far : usernamevar.draw(spritebatch, newinputtext); that draw newinputtext string each frame newinputtext = username.update(mouse); that set string heres problem class textbox { public texture2d texture; public rectangle rectangle; public bool isclicked; public textbox(texture2d newtexture, rectangle newrectangle) { texture = newtexture; rectangle = newrectangle; } public void draw(spritebatch spritebatch) { spritebatch.draw(texture, rectangle, color.white); } public string update(mousestate mouse) { rectangle mouserectangle = new rectangle(mouse.x, mouse.y, 1, 1); var textboxtext = new newtext(); if (mouserectangle.intersects(rectangle)) { isclicked = true; if (isclicked) { textboxtext.newtext = "a";

php - Why am I getting a break in the output of this WHERE loop? -

i made while loop game making looks this: updated full if statement if ($switch == 0){ echo '<a href="/index.php">exit voting booth - may vote again later</a></br>'; echo '<div role="main" id="main"><div class="wrapper">'; echo '<h3>ballot questions:</h3></br>'; $query = "select * ballot_questions"; $ballots = mysql_query($query,$link) or die("unable select: ".mysql_error()); $x = 1; //echo $x; while($row = mysql_fetch_array($ballots)) { echo '<h4>'.$row['question'].'<form action="vote_engine.php" method="post"> <input type="hidden" name="id" value= "',$id,'"> yes:<input type="radio" value="yes" name = "',$x,'"> no:<input type="radio" value="no" name = "',$x,'"></h4

Eclipse requesting different parameters wheter I use a class as an anonymous inner class or not -

i uploaded this. quick fix points same crazy parameters don't make sense when try implement class anonymous inner class. take , see if can crack what's going on in here http://i.imgur.com/mwmsblb.jpg

ios - Two Column Table View ? -

i want implement 2 column list of options. how work user selects 2 elements: 1 on left , 1 on right. @ point selected options highlighted. @ bottom "select" button. how go implementing this. use uitableview? i recommend using two-column uipickerview accomplish this. native ios control provide functionality looking in way users understand.

ios - How to improve the performance of UINavigationController's snapshot -

i use block of code take snapshot of uinavigationcontroller's view: @implementation uiview (snapshot) - (uiimage*)snapshot { nstimeinterval t0 = [[nsprocessinfo processinfo] systemuptime]; uigraphicsbeginimagecontextwithoptions(self.frame.size, self.opaque, [[uiscreen mainscreen] scale]); if([self iskindofclass:[uiscrollview class]]){ cgcontextref ctx = uigraphicsgetcurrentcontext(); cgcontexttranslatectm(ctx, 0, -((uiscrollview*)self).contentoffset.y); } [self.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage *snapshotimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); nstimeinterval t1 = [[nsprocessinfo processinfo] systemuptime]; nslog(@"time cost: %lf", t1 - t0); return snapshotimage; } @end 1, jasidepanelcontroller *sidepanelcontroller = //... uinavigationcontroller *navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:sidepanelcontroller]

hadoop - Error in Multiple Input Path in MapReduce -

i writing multiple input mapreduce program in eclipse, below part of code lines code: path map1=new path(args[0]); path map2=new path(args[1]); multipleinputs.**addinputpath**(job,map1, textinputformat.class,mapper1.class); multipleinputs.**addinputpath**(job,map2, textinputformat.class,mapper2.class); in "addinputpath" getting error below, error : method addinputpath(job, path, class, class) in type multipleinputs not applicable arguments (job, path, class, class) can on these? please find code in below link https://www.dropbox.com/s/fm3m0ed4gh6jy98/code regards, vishwa what can tell have wrongly imported incompatible, import org.apache.hadoop.mapred.textinputformat; which should have been, import org.apache.hadoop.mapreduce.lib.input.textinputformat; hadoop offers 2 apis create job, 1 belongs org.apache.hadoop.mapred , other org.apache.hadoop.mapreduce. think using latter , that's 1 should import.

date - Batch File to Automate backup folders -

so, have drobo server houses backup folder customers need have hard drive files backed up. create folder each customer in backup folder. it's our policy keep these files our customers 30 days, after which, need deleted. i'm wondering if possible make batch file can scan entire backup folder, each folder each customer only, not files, folder modified date , if older 30 days, move entire folder i'll label delete further review before deleting. i'm going make second batch file delete folders , files once inside delete folder, need first batch file scans folders' modified date in order determine if needs moved first. appreciated. thanks. forfiles /p c:\test\ /d -30 /c "cmd /c move @file c:/delete" just example of script might use

c# - How to keep my selection to the DataGrid Row after refresh the data grid using timer in WPF -

i have wpf datagrid , binding datagrid if changes made data automatically refresh selection datagrid row unselected. instead of using list store data, try using observablecollection . advantage of using observablecollection whenever add item collection ui automatically updated manually refresh of datagrid not required. below have shared sample application adds , updates record in datagrid . xaml: <grid> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="auto"/> </grid.rowdefinitions> <stackpanel orientation="horizontal"> <radiobutton name="cbadd" groupname="addoredit" content="add messages" ischecked="true"></radiobutton> <radiobutton name="cbupdate" groupname="addoredit" content="update messages"></radiobutton> </stackpanel> &

php - sql query generated by user selects -

i begginer , can’t find tutorial or example of dynamic sql query generated user selects. suppose have checkboxes or select fields 5 colors , 5 clothes types. automatically search example “blue” “t-shirt” ,do have pass using ajax values of “colour” , “type” search.php page , , create sql query select * table colour=”request_[‘colour’]” , type=”request_[‘type’]” ? is correct procedure ? i pass values through post/get ajax or straight form. it's choice. but php code be. <?php $colour = htmlspecialchars(mysql_real_escape_string($_post['colour'])); //or $_get $type = htmlspecialchars(mysql_real_escape_string($_post['type'])); //or $_get mysql_query("select * `table` `colour`='".$color."' , `type`='".$type."'"); i suppose way of doing it.

how to install .MSI using powershell -

i new powershell , have difficulty understanding. want install .msi inside powershell script. can please explain me how or provide me beginners level tutorial. $wiobject = new-object -comobject windowsinstaller.installer ????? why fancy it? invoke .msi file: & <path>\filename.msi or start-process <path>\filename.msi edit: full list of start-process parameters https://ss64.com/ps/start-process.html

Android DrawerLayout doesn't show the right indicator icon -

i'm trying use new drawerlayout list. problem though set drawer listener, indicator on actionbar still arrow icon instead of 3-line icon intends draw. following oncreate function: public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_front_page); // swiping pager set msectionspageradapter = new sectionspageradapter(getsupportfragmentmanager()); mviewpager = (viewpager) findviewbyid(r.id.pager); mviewpager.setadapter(msectionspageradapter); // sliding drawer set mhabitcontract = new habitscontract(this); mdrawerlayout = (drawerlayout) findviewbyid(r.id.front_page_layout); mdrawerlist = (listview) findviewbyid(r.id.habit_list); mdrawerlayout.setdrawershadow(r.drawable.drawer_shadow, gravitycompat.start); mdrawerlist.setadapter(new habitadapter(mhabitcontract.gethabititems(), this)); // fixme: indicator image doesn't show mdrawertoggle = new actionbard

javascript - is it possible that by clicking, the class of the element change? -

i want put switch website when click language of page change. yesterday saw close live example in website. here's link: http://iranfilm76.com/ the object on left side in header i'm trying achieve, instead of changing background want change language. i have functions changing language, problem object, download image , css file. i take close @ codes firebug , when click on tag class of tag changes class="changestyle" . how can this? suggestion. your_element.addeventlistener("click", function(){ this.classlist.toggle("changestyle"); }); demo: http://jsfiddle.net/derekl/kpwkg/ | http://jsfiddle.net/wsgga

hiveql - Can we have partitions within partition in a Hive table? -

can partitions within partitions in hive table. i mean can partition partitioned table? or bucketing option in hive tables? hive supports multiple levels of partitioning. keep in mind having more single level of partitioning in hive never idea. hdfs optimized manipulating large files, ~100mb , larger. each partition of hive table hdfs directory. there multiple files in each of these directories. should closing on petabyte of data make multiple levels of partitioning in hive table. what problem trying solve? i'm sure can find sensible solution it.

update the part of HTML text inside DIV using Jquery -

<div class="test"> name - date //first name ,last name - 7/24/2013 <button type="button"/> how update part of html text inside div using jquery. i need update date section alone inside div. tried having date section in span class name , update text. but there must way update text without having <span> . am looking fix without using thanks i suggest bit of different way, using regular expression. (although best way use span element.) var testpattern = /date/; var divtotest = $('.test').html(); divtotest = divtotest.replace(divtotest.match(testpattern),'yourdate'); $('.test').html(divtotest); also keep in mind, if date example dd.mm.yyyy format , need change reg exp specific format. hope helped :). (edited: @geoff appleford)

apache - Hide the python script part in the url -

i have been looking around , found tons on informations , posts argument, every solution have tried has failed me. decided ask posting specific scripts here. i'm deploying on share host (bluehost) application written in python pylons: www.rhodecode.org everything works, little slow because apparently bluehost don't support mod_wsgi, have use standard cgi, works , python (cgi) script , .htaccess #!/usr/bin/python activate_this = '/home2/danielen/rhodecode-venv/bin/activate_this.py' execfile(activate_this, dict(__file__=activate_this)) import wsgiref.handlers paste.deploy import loadapp myapp = loadapp('config:/home2/danielen/rhodecode/production.ini') wsgiref.handlers.cgihandler().run(myapp) options +execcgi addhandler cgi-script .py <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.py$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.py

how to write a batch file which can identify value from a text file and store that value in some other text file -

i have text file have number content , string content,i want write batch can identify number content , store number content each line in other text file. this example work integer numbers between spaces. special caution must put in text file, behaviour " , < , | , > , & may unpredictable. some optimizations may made having more information text file. for /f "tokens=*" %%i in (textfile.txt) call :getnumber %%i goto :eof :getnumber if "%~1"=="" goto :eof set number= set /a "number=1*%~1" if "%number%" == "%~1" call :storenumber %number% shift goto :getnumber :storenumber echo %number%>number.txt

ios - iPhone site animations -

i have never made site responsive iphone. i curious @ how go making cross compatible site (iphone, chrome,etc) have graphical animations(similar flash). tools supposed use graphic animations when cannot use flash? if want complete cross compatible site way go build webapp html, html5, javascript, css. nothing else work across devices. forget flash. what need have server api's common devices way present data customized device's form factor. particular ui design technique called - responsive design . basically backend apis remain, data served backend same html templates served backend change depending on device making request, figured out client's user-agent eg. iphone mozilla/5.0 (iphone; u; cpu mac os x; en) applewebkit/420+ (khtml, gecko) version/3.0 mobile/1a543a safari/419.3 . different clients have different user-agents. plus have small javascript send particular device's screen dimensions server. again, helps choose correct templates serve. reg.

mysql - SQL WHERE abc = n returns wrong data -

so i'm trying find number of rows according following command: select count( distinct `increment_id` ) `orders` `created_at` '%2013-07%' , `store_id` =1 , `status` not '%canceled%' this returns number, x . select count( distinct `increment_id` ) `orders` `created_at` '%2013-07%' , `status` not '%canceled%' this returns number x , wrong. in case 1, number should less in case 2, because i'm filtering more rows. type of store_id tinyint(4) . are queries wrong? how make work want work? ps: have checked manually, , number must low. there's nothing skewed data. not records have store_id =1. just because not rows have same store_id not mean these results should different. if have, example, increment_id has 3 records store_id=1 , store_id=14 , store_id=99 appear in of queries. try query see examples... select `increment_id`, sum(case when `store_id` = 1 1 else 0 end) `count_of_store_id_1`,

singularitygs - singularity gs remove the left/right margins -

i using singularitygs first time. wondering how remove left/right margins (gutters)? alpha/omega options in 960gs. there that? thank you. aware of $location. did not describe problem properly so following scenario: <article> <div class="teaser"></div> <div class="teaser"></div> <div class="teaser"></div> <div class="teaser"></div> </article> <sidebar></sidebar> $grids: 12; $gutters: .2; article { @include grid-span(8); } sidebar { @include grid-span(4, 9); } .teaser { @include float-span(4, 1, 8); &:nth-child(odd) { // here want remove right-margin - because otherwise containers not floating. dirty way be: margin-right: 0 !important; } } singularity has location variable second argument. @include grid-span($width, $location); you can change $location 1 if first column on grid or 12 if last column on 12 colu

ios - Load image with same name in different folders -

in xcode project ios, have 2 images of same name header.png in following folders folder1 , folder2 . when used following code uiimage *backgroundimage = [uiimage imagenamed:@"header.png"]; i image folder2. if use uiimage *backgroundimage = [uiimage imagenamed:@"folder1/header.png"]; i nothing. any idea how access image in folder1 , folder2?

javascript - document.documentElement function does not display proper result -

i trying parse xml file using java-script. according tutorial read found root element, have use document.documentelement . i use syntax when tried display returned value syntax, browser displays [object htmlhtmlelement] . my question is: (1) why getting [object htmlhtmlelement] displayed in web browser. (2) according below posted xml-file, should expect output after using rootelement = document.documentelement; please find below code used(javascript) , xml file. javascript function findwriter() { var schriftstellerknoten, spracheknoten; var fuellerknoten, dichtungknoten, anzeige, rootelement; rootelement = document.documentelement; document.write(rootelement); } xml file : <?xml version="1.0" ?> <schriftsteller> <englischsprache> <dichtung> <fueller> <name>jane austin</name> <name>rex stout</name&g

Updating a WP8 in Windows Store -

i made bugfixes app , need update current wp8 app newer version. how process done in wp8 store. need upload new app or can adjust current app? it's quit hard find information uploading process of update wp8 app. select app in dev center, click update app, upload new xap file

jquery - Chrome doesn't play my embed file, the request to audio file gets "canceled" -

i have page uses jquery play sound whenever users make error. here part of html: <embed id="beepcache" src="sound/beep.wav" autostart="false" type ="audio/x-wav" width="0" height="0" hidden="hidden" /><!-- caching! --> i use locally cache file, plays instantly. jquery function plays sound. adds , removes embed element in dom. function playsound() { $('body').append('<embed id="beep" width="0" height="0" type ="audio/x-wav" src="sound/beep.wav" autostart="true" hidden="hidden">'); //wait 1 sec remove embed element settimeout(function() { $('#beep').remove(); }, 1000); } so code works in ie, ff , opera, used work in chrome. when worked noticed request beep.wav cache hits. however status (canceled). thought chrome smart ,

image - Jquery two .get() functions working differently -

the first .get() function works in browsers , second 1 works every time in firefox, every second time in chrome , not @ in ie. the code wrapped in $(document).ready function, should not problem page loading. the first .get() function gets recent news rss feed , posts them in <ul> . second .get() function gets same things different rss feed , posts them in similar way, difference gets image sources , i'm drawing these images <canvas> elements in last part of code. even without drawing images canvas elements, , without getting image sources, second .get() function not work every time in chrome , never in ie. first 1 works every time in browsers. i using similar piece of code draw other images canvas elements, , works everywhere , everytime. //the first, working .get() function: $.get("rss-url", function (data) { var $xml = $(data); var $i = 0; $xml.find("item").each(function () { var $this = $(this), i

android - Unable to retrieve email address from Facebook API -

i getting null pointer exception while getting email address facebook api on android 3.0. the code generating exception below: loginbutton authbutton; authbutton = (loginbutton) findviewbyid(r.id.authbutton); // set permission list, don't forget add email authbutton.setreadpermissions(arrays.aslist("basic_info", "email")); authbutton.setsessionstatuscallback(new session.statuscallback() { @override public void call(session session, sessionstate state, exception exception) { showtoast("inside call"); if (session.isopened()) { showtoast("inside session"); system.out.println("facebook access token" + session.getaccesstoken()); fbtoken = session.getaccesstoken(); request.executemerequestasync(session, new request.graphusercallback() {

mysql - Determine entrys with "missing" subsequent entry in SQL -

i have table in sql represent sort of events. try determine lines specific event not "followed" specific event. in table below lines signed did not sign out afterwards (lucy , joe). achievable sql , if yes how? |id|name |event | ========================== |01|fred |sign | ------------------------- |02|joe |sign | -------------------------- |03|lucy |sign | -------------------------- |04|joe |do foo | -------------------------- |05|joe |sign out | -------------------------- |06|joe |sign | -------------------------- |07|fred |sign out | -------------------------- many thanks select * table t1 left outer join table t2 on(t1.name=t2.name , t2.event='sign out') t1.event='sign up' , t2.name null there's no such thing "followed by" unless define you'll need provide more info. (it might adding "t1.id >t2.id" in on clause)

python - Tkinter: Highlight/Colour specific lines of text based on a keyword -

i looking simple way search through line of text , highlight line if contains specific word. have tkinter text box has lots of lines like: "blah blah blah failed blah blah" "blah blah blah passed blah blah" and set background colour of "failed" line red. far have: for line in results_text: if "failed" in line: txt.tag_config("failed", bg="red") txt.insert(0.0,line) else: txt.insert(0.0,line) this prints out want nothing colours this wrong way change text colour. please help!! use text.search . from tkinter import * root = tk() t = text(root) t.pack() t.insert(end, '''\ blah blah blah failed blah blah blah blah blah passed blah blah blah blah blah failed blah blah blah blah blah failed blah blah ''') t.tag_config('failed', background='red') t.tag_config('passed', background='blue') def search(text_widget, keyword, tag):

c# - Does TFS "Track Changes" for searched local files? -

i'm not sure if understand question here goes. i working on project checked-in tfs. solution has multiple projects aside mine. accidentally searched "entire solution" something. when closed visual studio , got latest version, asks me latest version files not project working on! sure didn't check files there , i'm sure didn't make changes. i haven't worked tfs not sure if natural behaviour. checked files if changed i'm pretty confident didn't. i'm wondering why included in "get latest file" version when open visual studio , tfs.. is normal behaviour or change made there?

integration - Is there anyway to easily improt from Sugar CRM into Pentaho PDI Kettle? -

it seems used plugin in 2009 link not work anymore ( http://wiki.pentaho.com/display/eai/sugarcrm+plugin ). suggestion/reference? thanks! can't access database directly? that's i've done in past. alternatively try api. i suspect reason plugin in days gone past webservice elements of pdi not scratch @ time.