Posts

Showing posts from September, 2012

html - select multiple child in css -

i trying apply ellipsis class in css table. there columns need have ellipsis class. have multiple columns in table. i doing nth-child property in css, there way select random multiple child? i tried- .listtasktime tbody tr >td:nth-child(3) { text-overflow: ellipsis; width:150px; display: block; overflow: hidden; word-break:keep-all; zoom:normal; line-break:normal; white-space:pre; } though same table has 1 more column 5th-child , child need make separate class, hence other columns. i don't want expand css code. there other solution? you can separate classes comma , .listtasktime tbody tr >td:nth-child(3), .listtasktime tbody tr >td:nth-child(6), .listtasktime tbody tr >td:nth-child(9) { /* common styles goes here, styles apply child 3,6 , 9 */ } note: need check nth-child , define manually in stylesheet, css cannot decide if columns increase. if using server side language generating dynamic table, can

java - Class Cast Exception - Mouse event -

Image
a bit of context - creating rudimentary implementation of scrabble , gui relies on java swing , awt. code excerpt below contains constructor cell class (individual space on scrabble board). in proof of concept phase , testing addition , removal of hard-coded letter icon individual cell. each cell individual jpanel jlabel (which, contains imageicon of letter). code looks though works without error, every 5-6 additions/removals (via mouse click) causes class cast exception. specific exception is: exception in thread "awt-eventqueue-0" java.lang.classcastexception: cell cannot cast javax.swing.jlabel i can't see exception caused, more why occurs after multiple successful additions , removals. insight appreciated; beginner java gui. public class cell extends jpanel { /*tile colors*/ public static color twcolor = new color(255, 0, 0); public static color dwcolor = new color(255, 153, 255); public static color tlcolor = new color(0, 51, 255); public static color dlco

database - Android: No such column -

here´s log-file: 05-04 09:29:10.968: e/sqlitelog(26491): (1) no such column: datum 05-04 09:29:10.968: d/androidruntime(26491): shutting down vm 05-04 09:29:10.968: w/dalvikvm(26491): threadid=1: thread exiting uncaught exception (group=0x40edc930) 05-04 09:29:10.976: e/androidruntime(26491): fatal exception: main 05-04 09:29:10.976: e/androidruntime(26491): java.lang.runtimeexception: unable start activity componentinfo{com.example.unserekinder/com.example.unserekinder.mainactivity}: android.database.sqlite.sqliteexception: no such column: datum (code 1): , while compiling: select name, datum, geschlecht kind 05-04 09:29:10.976: e/androidruntime(26491): @ android.app.activitythread.performlaunchactivity(activitythread.java:2180) 05-04 09:29:10.976: e/androidruntime(26491): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2230) 05-04 09:29:10.976: e/androidruntime(26491): @ android.app.activitythread.access$600(activitythread.java:141) 05-04 09:29:10

Rails: Displaying pages navigation inside application layout -

i'm trying display page navigation rails in addiction page_title outputs record's informations inside brackets this: - [#<page id: 1, page_title: "about", page_content: "about page content", created_at: "2013-05-04 06:38:03", updated_at: "2013-05-04 06:38:03">] - other page [#....etc...] how can fix this? thx. application.html.erb <li> <%= @pages.each |p| %> <%= link_to page_path(p.id) %> <%= p.page_title %> <% end %> <% end %> </li> application_controller.rb class applicationcontroller < actioncontroller::base protect_from_forgery before_filter :set_layout_variables def set_layout_variables @pages = page.all end end remove = in line <%= @pages.each |p| %> it should be <li> <% @pages.each |p| %> <%= link_to page_path(p.id) %> <%= p.page_

lua - Corona going to previous scene results in black screen -

i've got problem delaying game milestone, in scene1 click menu button takes me menu when user wants play again click play button , should go previous scene when goes black screen. here code, main menu button in scene 1: function scene:enterscene(event) local group = self.view function menubutton:touch( event ) if event.phase == "began" storyboard.gotoscene( "menu", "slideright", 750 ) audio.play(click) display.getcurrentstage():setfocus( event.target ) event.target.isfocus = true elseif event.target.isfocus if event.phase == "moved" print( "user has moved finger off button." ) elseif event.phase == "ended" print( "user has switched main menu" ) display.getcurrentstage():setfocus( nil ) event.target.isfocus = false end end return true end here play button on main menu: function scene:enterscene(event) local group = self.view local functi

symfony - symfony2 free -m out of memory -

i have symfony2 app out there. have ram memory problems... works charm when there 50 active people (google analytics). i select data db usally this: $qb=$this->createquerybuilder('s') ->addselect('u') ->where('s.user = :user') ->andwhere('s.admin_status = false') ->andwhere('s.typ_statusu != :group') ->setparameter('user', $user) ->setparameter('group', 'group') ->innerjoin('s.user', 'u') ->orderby('s.time', 'desc') ->setmaxresults(15); return $query=$qb->getquery()->getresult(); the queries fast dont have problem them. let me please know need , paste here. need fix much.. but problem come now: when there 470people @ same time.. (google analytics) there 7gb of memory away... fall down after peak 5gb. why much??? scripts take 10-17mb of m

java - HashMap and sorting -

i building trie, each node has hashmap sons' value stored, , keys name. i'm using hashmap because, mainly, need performances instead of sorting, instead have used treemap, of course. now, need, in function, sort hash map values key values (that strings). i'm using iterator iterate values. any suggest? thank you you should put map.keyset in list sort , iterate on list of sorted keys.

jax ws - JAX-WS implementation annotations vs. interface annotnations -

i configure jax-ws web service using annotations. use endpoint interface annotated values , used server client, share interface. my interface looks this: @webservice(name = constants.name, servicename = constants.service_name, targetnamespace = constants.namespace) @soapbinding public interface imanagementbean { @webmethod(operationname = "getstatistics") igetstatsresponse getstatistics(igetstatsrequest request, @webparam(name = "gridname", header = true, partname = "gridname") string gridname) throws webserviceexception; } in corresponding implementation use same annotations, looks quite redundant me. is there way tell implementation "pull" annotations interface instead of defining them on both sides? if don't interface, avoid interface. you can safely start without interfaces , introduce them later need arises. approach fundamentally different in java ee 5. compared java 2 platform, enterpr

Read/Copy iphone contacts from PC using C# -

can guide me how read contacts iphone pc using c# application. recently, had used mobiledevice.dll http://mobiledevice.codeplex.com/ . can retrieve model, serial number, version, firmware information, jailbroken status, , more. but there no api read address book of iphone device(the contacts stored in sqlite database @ location: /private/var/mobile/library/addressbook/addressbook.sqlitedb). don,t know how copy addressbook.sqlitedb file pc. i know possible, there number of desktop applications doing same task ifunbox, iexplorer, http://www.iphone-to-pc.com/ add these code in viewdidload: abaddressbookref addressbook =abaddressbookcreate(); cfarrayref allpeople = abaddressbookcopyarrayofallpeople (addressbook); cfarrayref allgroups = abaddressbookcopyarrayofallgroups(addressbook); (id person in (nsarray *) allpeople) [self logcontact:person]; (id group in (nsarray *) allgroups) [self loggroup:group]; cfrelease(allgroups); cfrelease(allpeople); cfrelease(addre

c# - How to get all characters in a Culture? -

i developing on .net 4.5, english. need capture "normal printable" characters culture 1041 (japanese) used human readable communication string in code. if building us-eng string, result in ascii table 32 127. don't know equivalent of hat culture code 1041... all ideas appreciated, thanks.

python - set the text of an entry using a button tkinter -

i trying set text of entry using button in gui using tkinter. gui me classify thousands of words. 5 categories, each of categories has button. hoping using button speed me , want double check words every time otherwise use button , have gui process current word , bring next word. command buttons reason not behaving want them to. example def cwin(): win = tk() v=stringvar() def settext(word): v.set(word) = button(win, text="plant", command=settext("plant") a.pack() b = button(win, text="animal",command=settext("animal")) b.pack() c = entry(win, textvariable=v) c.pack() win.mainloop() so far when able compile click nothing. you might want use insert method. this script inserts text entry . inserted text can changed in command parameter of button. from tkinter import * def set_text(text): e.delete(0,end) e.insert(0,text) return win = tk() e = entry(win,width=10) e.pack() b1 = button(win,text="an

android - Curve Shape List Item -

hey new in android... actually, don't know how develop curve style listview... please give me concept/code develop curve shape list item... i want develop these kind of scrolling menu(visit link) display in second number screen-shot on play store... thanks in advance.... just create shape.xml in drawable folder , put code inside <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#000000"/> <stroke android:width="5dp" android:color="#313131"/> <corners android:radius="10dp" /> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /> </shape> then can set background in list item. "play" stroke, radius dimensions , colors in shape create own custom one. in

php - Uncaught CurlException: 35: Unknown SSL protocol error in connection to graph.facebook.com:443 -

i keep getting error, , seems has appeared out of nowhere. i've been working @ project weeks, , didn't show until now. when try run app on localhost , error in title shown. have tried adding $opts[curlopt_sslversion] = 3; in base_facebook.php specified in post, didn't work. have no idea should now. can give me helping hand? change registry values: hkey_local_machine\system\currentcontrolset\control\securityproviders\schannel\protocols\ssl2.0\client "disabledbydefault"=dword:00000000(0)

css - JavaScript Changing BG Color -

i made div background-color set rgb(0,0,0); , want change it's color on click javascript. made function that. function change(){ var x = 1; var y = x + 100; document.getelementbyid("box").style.backgroundcolor = "rgb(" + y + "," + y + "," + y + ")"; } it works fine can change div's color once. want div's color value , set x , run function again. bg go black->grey->white on each click. depending on y variable. i can div's value it'll in "rgb(0,0,0);" format. don't know after getting this. how manipulate integers in rgb(0,0,0); ? you can store current x value in data attributes: function change(box) { var x = +box.getattribute('data-x'), // +box.dataset.x modern browsers y = x + 100; box.style.backgroundcolor = "rgb(" + y + "," + y + "," + y + ")"; box.setattribute('data-x', y); } html <div id=&

wcf - How to increase maxReceivedMessageSize -

i have wcf service , sending large streams service client. this code in client web config <bindings> <basichttpbinding> <binding name="blabla" allowcookies="true" maxreceivedmessagesize="2147483647" maxbuffersize="2147483647" maxbufferpoolsize="2147483647"> <readerquotas maxdepth="32" maxarraylength="2147483647" maxstringcontentlength="2147483647"/> </binding> </basichttpbinding> </bindings> when wanted set maxreceivedmessagesize more 2 gb, error. says "int32 value can not initialize value". possible set 40 gb or bigger value? maxreceivedmessagesize can set more int.maxvalue , if transfer mode of binding set streamed . should not set maxbuffersize 2gb, otherwise may huge memory usage in client.

java - Swap sublists in a List<MyObject> -

is there easy method swap 2 sublists in list. example: [0 1 2 3 4 5 6 7 8 9 10 11] --> [0 1 8 9 10 4 5 6 7 2 3 11] --> sublist1= [2 3] --> sublist2= [8 9 10] if okay indexes, can done using sublist function multiple files , creating new list object shown below... list<integer> newlist = new arraylist<integer>(mylist.sublist(0, 4)); newlist.addall(mylist.sublist(7, 9)); newlist.addall(mylist.sublist(4, 7)); newlist.addall(mylist.sublist(9, 12)); here swapping index 4 6 indexes 7 8 if want using elements, first use elements find indexes of sublist , use above procedure. don't confused endindex of sublist function... fromindex - low endpoint (inclusive) of sublist toindex - high endpoint (exclusive) of sublist if mention 7,9 in sublist function means elements index 7 till elements below index 9.

regex - How to match start and end of a string? -

i'm trying use notepad++'s find & replace regular expression on following sample: 3 733xxxx (-1) 3 1521xxxx (-1) 3 1521xxxx (-1) how can keep following unmatched? 733xxxx 1521xxxx 1521xxxx i've tried using following expressions: ^(.* \(-1\)).*$ ^(\(-1\))$ the first 1 matches everything, second: nothing. can point me in right direction? there several ways approach this: replace "^ *\d+ +" , " *\(-1\)$" (the quotes clarity) empty string (2 steps) replace "^ *\d+ +(\d+).*$" $1 \d short-hand character class, matches whatever [[:digit:]] matches (numeric digits). (notepad++ uses boost regex). testing, seems it can match unicode numeric digits , don't think going matter in application. the ^ *\d+ + part match text before numbers in middle.  *\(-1\)$ matches spaces , (-1) @ end of line. for ^ *\d+ +(\d+).*$ , regex match whole line, retain part want, numbers in middle. () (which not escap

jquery - Hide sensitive data in html table column -

i have html table , first column has id. column hidden. have read bad approach. but need hidden id when user selects row , click delete button ajax post id. where else should put id per row differently , why approach bad? add id attribute in table rows. this: <tr data-id="1"> <td><span class="delete">delete</span></td> </tr> <tr data-id="2"> <td><span class="delete">delete</span></td> </tr> and when user click on delete or edit, jquery. $('.delete').bind('click', function (e) { var $row = $(this).closest('tr'); var id = $row.attr('data-id'); // have `id` });

audio streaming - OPUS source client for Icecast -

i looking source client let me stream opus audio through icecast2 streaming server. the problem trying establish "internet-radio" streaming audio low bitrates. opus codec purpose, cannot find source client icecast2 allow encoding opus codec. next version of darkice (verison 1.2) have opus support. http://darkice.googlecode.com right i'm streaming opus 32kbit/s using darkice svn revision 540 icecast 2.4 beta3 , receiving vlc.

java - Ignore org.xml.sax.SAXParseExceptions when transfer xml string to org.w3c.dom.Document? -

i have lot of html pages (i mean source codes) represented java.util.list of strings in java. need convert document objects in java (from package org.w3c.dom). i way documentbuilderfactory , document: public static org.w3c.dom.document inputstream2document(inputstream inputstream) throws ioexception, saxexception, parserconfigurationexception { documentbuilderfactory dbf = documentbuilderfactory.newinstance(); dbf.setvalidating(false); org.w3c.dom.document parse = dbf.newdocumentbuilder().parse(inputstream); return parse; } some of pages transformed right way there problem there other pages example wrong written attributes , not valid (attributes without ="" ... looks <a href="somepage.html" someattr> for wrong written attribut called "someattr"). , in cases exceptions, example nested exception: org.xml.sax.saxparseexception; linenumber: 7558; columnnumber: 71; element type "a" must followed either attribu

playframework - Why "play run" doesn't read my configuration file? -

i'm using "play run" when implement on play framework because supports auto-compile feature. seems "play run" doesn't read configuration file specify. i'm running play framework follows: $ play "run -dconfig.resource=application.conf" but configurations written on application.conf totally ignored. if "play start" instead, configuration file works fine. there way specify configuration file "play run" ? i'm using play framework 2.1.1 on macos 10.8.3. play doesn't seem listen configuration option config.resource . quick google search led this blog post , suggested use config.file instead. value here file name, relative play application's root directory. well, create proper answer, had research how change main configuration file. i've found play checks config.file property, , if doesn't exist, uses conf/application.conf . therefore, way run custom configuration file is play &

ruby - Regexp to match multiline single or double quoted strings -

i'm building ruby script read ruby sources files looking calls function _() , grabing strings of parameter passed it, can multiline string, single or double quoted, example: grab: hello world _('hello'+ ' world') grab: hello \nworld _("hello \ world") grab: hello "world" _("hello \"world\"") grab: hello 'world' _('hello \'world\'') so need regexp match , grab string parameter. how can that? attempting analyze source code regex leads complex fragile code doesn't work in cases. need account enclosing single , double quotes, here docs, quotes within parentheses, etc. what need ruby lexer. there several of these, written in ruby, in antlr, 1 in lex. lexer parse source tokens, scan token list find pieces want. you might ideas how looking @ ruby interpreter or @ syntax colouring code in opensource editor. an alternate way write regex locates interesting tokens, sin

Haskell synonym definition -

could explain me following synonim means , how read it: type tcm = errort string (statet myenv io) what able understand till now: we introduce new name type , call tcm , has parameter a we have value constructor errort (what makes errort?) takes 3 arguments: string, (statet myenv io) , a (statet myenv io) - here have value constructor statet , args myenv , io. type makes? am right? explain me how works? responses. edit: maybe me this. have sth following function in program evaluate integer: ms_exp :: exp -> tcm () ms_exp (eint integer) = return integer and have such error: couldn't match expected type `()' actual type `integer' any hints? well, errort type had a type parameter, if wished, specialize it, is, make type type tcmint = errort string (statet myenv io) int however, can leave type parameter, did in example. no, errort not value constructor, type constructor. makes element of errort ? well, depends on errort

iphone - Remote wipe iOS devices -

trying develop byod service enterprise. new ios , starting basic services remote wipe web console. how should approach problem? tutorials/blog posts on topic? found services remote wipe , find phone available on icloud. should use icloud api on web control panel it? if enterprise uses microsoft exchange can setup policies control remote wiping through exchange. policy options pretty powerful. can give user access wipe own device through webmail portal or exchange admin's can wipe device...

javascript - Cloud9 IO disabling keybindings or Cloud9 alternative -

i have found cloud9.io , i'm going use teaching people code in html, css, javascript , php, there 1 problem. czechs , if want create { , press right-alt + b , } , press right-alt + n . however, that's problem in cloud9.io, whenever press } , thinks want create new file, because press rigth-alt + n . there way disable these keybindings, or edit js won't use keybindings? or if it's not possible, know alternative cloud9.io, can use teaching other people code, can see coding live, has chat , can edit files can see. thank you. you can configure under preferences > keybindings. try double-clicking, pressing backspace , enter remove existing keybinding.

canvas draw rounded rectangle in reverse? -

i apologise in advance asking this, kindly provided code draw rounded corner rectangle progress bar great: http://jsfiddle.net/p2qtq/ i need reverse drawing of rectangle can't life of me manage it http://jsfiddle.net/p2qtq/7/ i tried changing points @ 4 lines , 4 corners drawn starts top left corner i'm making total mess of it: var startt = 0; var starttr = horizlinelength; var startr = starttr + cornerlength; var startbr = startr + vertlinelength; var startb = startbr + cornerlength; var startbl = startb + horizlinelength; var startl = startbl + cornerlength; var starttl = startl + vertlinelength; to var starttl = 0; var startl = starttl + cornerlength; var startbl = startl + vertlinelength; var startb = startbl + cornerlength; var startbr = startb + horizlinelength; var startr = startbr + cornerlength; var starttr = startr + vertlinelength; var startt = starttr = cornerlength; can point me in right direction please?

Clear python shell within script -

i trying create utility program, after user types in passcode , goes main menu, passcode still there , show right above it. asked question before, users gave me command instead of script you. wondering if there can type script can clear python shell without having directly type shell. you should use getpass read passwords without echoing them, that's reccomended way of reading passwords safely.

sql server 2008 r2 - Invalid Columns in referenced table -

im setting couple tables in new database. have users table, companies table, usercompanies table (so user can work many different companies), , userpay table. create table tblusers ( [usertableid] int identity not null primary key, [useremail] varchar(50) not null, [userfirstname] varchar(20) not null, [userlastname] varchar(20) not null, [useraddress1] varchar(45) null, [useraddress2] varchar(45) sparse null, [usercity] varchar(45) null, [userstate] varchar(2) null, [userzipcode] varchar(10) null, [userphone] varchar(13) null, ) create table tblcompanies ( [companyid] int identity not null primary key, [companyname] varchar(45) not null, [companyaddress1] varchar(45) null, [companyaddress2] varchar(45) sparse null, [companycity] varchar(45) null, [companystate] varchar(2) null, [companyphone] varchar(13) null, [companyphoneextension] varchar(8) null, [companycontactfirstname] varchar(20) not null, [companycontactlastname] varchar(20) not null ) create table tblusercomp

java - How to clear drawing on a canvas in Android -

i have set canvas drawing. problem how clear drawing. tried doing no avail. public void clear() { circlepath.reset(); mpath.reset(); // calls ondraw() method //invalidate(); } please take @ whole code here: https://gist.github.com/akosijiji/a29cca90bead2e5e35ad any appreciated. on button click b1.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub dv.clear(); // call clear method using in custom view } }); define clear method in custom view public void clear() { mbitmap = bitmap.createbitmap(width,height , bitmap.config.argb_8888); mcanvas = new canvas(mbitmap); mpath = new path(); mbitmappaint = new paint(paint.dither_flag); //added later.. mpaint = new paint(); mpaint.setantialias(true); mpa

mysql - How can I filter a table with duplicate entries to display the rows that exist the most? -

i hope question makes sense.. have table called genre_tags contains music_id , genre_id column it can contain duplicate entries music_id | genre_id 281 3 281 3 281 4 243 7 90 6 90 6 90 10 what want retrieve duplicate entries based on genre_id so based on example above left result music_id | genre_id 281 3 243 7 90 6 try this, select music_id, genre_id tablename group music_id, genre_id having count(*) = (select count(*) total tablename b a.music_id = b.music_id group music_id, genre_id order total desc limit 1) sqlfiddle demo

c# - How to delete in linq? -

i select 1 id db , want delete row id: var ado = new mydbentities(); var selitem = listview3.selecteditems[0]; if (selitem != null) { var selid = (from t in ado.task t.t_name == selitem.text select new { t.id}); ado.task.deleteonsubmit(selid); //this command return error } i trying delete deleteonsubmit , error. how can delete row db ? edit: since seem working objectset , you'll need use deleteobject() ; var sel = (from t in ado.task t.t_name == selitem.text select t).firstordefault(); if(sel != null) ado.task.deleteobject(sel); deleteonsubmit() takes entity parameter, not anonymous type. should work better; var sel = (from t in ado.task t.t_name == selitem.text select t).firstordefault(); if(sel != null) ado.task.deleteonsubmit(sel); if want delete multiple entities, use deleteallonsubmit() takes enumerable of entities; var sel = t in ado.task

sql - Mapreduce Table Diff -

i have 2 versions (old/new) of database table 100,000,000 records. in files: trx-old trx-new the structure is: id date amount memo 1 5/1 100 slacks 2 5/1 50 wine id simple primary key, other fields non-key. want generate 3 files: trx-removed (ids of records present in trx-old not in trx-new) trx-added (records trx-new ids not present in trx-old) trx-changed (records trx-new non-key values have changed since trx-old) i need operation every day in short batch window. , actually, need multiple tables , across multiple schemas (generating 3 files each) actual app bit more involved. think example captures crux of problem. this feels obvious application mapreduce. having never written mapreduce application questions are: is there emr application this? is there obvious pig or maybe cascading solution lying about? is there other open source example close this? ps saw diff between tables question solutions on there didn't scalable. pps here little r

c# - Works for GET, not for POST (404 error) -

i have webapi controller servicesapicontroller in mvc4 project signature so: [authorize(roles = "sysadmin,secretary")] [acceptverbs("get", "post")] public ienumerable<stock> toprankedstocks(int maxrecords) { // stuff return result; } my routing api controllers looks this: config.routes.maphttproute( name: "servicesapi", routetemplate: "api/{controller}/{action}", defaults: new { controller = "servicesapi", action="index" } ); using iis express, if navigate http://localhost:62281/api/servicesapi/toprankedstocks?maxrecords=20 in browser, nice xml list of data objects. however, if call so: myhttpclient.baseaddress = "http://localhost:62281/"; var arguments = new list<keyvaluepair<string, string>>(new[] { keyvaluepair<string, string>("maxrecords", "10") }); var content = new formurlencodedcontent(arguments); var result = myhtt

objective c - Copy a directory including all contents and subdirectories -

i'm making mac app , i'm trying copy content , subdirectory of folder , paste another. i've tried files being copied. there way that? i'm using copyitematpath: api , here of code: nsstring *partsfromstring = ksppartsfrompathstring; nsstring *partstostring = ksppartstopathstring; nserror *error = nil; manager = [nsfilemanager defaultmanager]; bool result = [manager copyitematpath:partsfromstring topath:partstostring error:&error]; if (!result && error) { nslog(@"there error copying file directory! %@", [error localizeddescription]); }

Throw exception where the class was instantiated - C# -

i developing library used programmers. when throwing exception, debugger goes exception thrown, , not class instantiated or method executed. with try .. catch can solved, if programmer using library not open try .. catch? see code! how can avoid this? he see code! well yes, if distribute code. if don't, how expect code seen? don't forget you're in different situation developers using library, have source code on machine. try same dll on machine doesn't have source code. the developer may see decompiled version of code, perhaps - such great problem? if so, should @ obfuscating code - aware that comes logistical downsides too. i suspect isn't problem.

git - Most efficient way to update live heroku app without typing for each update? -

i find myself updating live rails application on heroku without needing speficiy description commit in git commit -m "description of change" is there command or gui app allow me update app 1 click/line? the action encompass following: git add . git commit -m "text" git push heroku master (i realize full might break best practice approach tdd.)

Python webbrowser module sometimes fails to open url in Chrome -

i have chrome configured default browser, on mountain lion. at end of python 2.7.4 program have following: import webbrowser webbrowser.open('http://example.com') sometimes instead of opening tab as documentation suggests happen command focus google chrome, without opening url in new tab. i'm not sure start debugging (there no errors on python side, @ least). i'd appreciate ideas start looking. it looks there's chrome specific code in webbrowser 2.7 source code: http://hg.python.org/cpython/file/2.7/lib/webbrowser.py however when opened python file on computer, running earlier version of webbrowser.py source code, without chrome specific flags. i updated source code on system latest code (from website) , it's running in chrome without problems. it's been fixed in python 3.3, assured.

python - 'Port' object has no attribute 'socket' -

i'm using twisted python make simple ssh server on custom port. create port object port = reactor.listentcp(_port, sshfactory) , _port variable holds integer of port. free port when shutting down server commands port.loseconnection() , port.connectionlost(reason=none) . if attempt start server, stop it, , start again, titular error 'port' object has no attribute 'socket' edit: full error message: unhandled error in deferred: traceback (most recent call last): file "c:\python27\lib\site-packages\twisted\internet\base.py", line 1175, in mainloop self.rununtilcurrent() file "c:\python27\lib\site-packages\twisted\internet\base.py", line 779, in rununtilcurrent call.func(*call.args, **call.kw) file "c:\python27\lib\site-packages\twisted\internet\defer.py", line 238, in callback self._startruncallbacks(result) file "c:\python27\lib\site-packages\twisted\internet\defer.py", line 307, in _startruncallbacks

perl - If a line starts with a specific word, how to change a targeted word in that line if it does exist? -

looking search through files in directory, looking @ every line , if line starts word such " this ", search line find , replace targeted word. did solution being 1 line command, looking have perl file or .txt file using bash if possible. example: this rabbit jumped high rabbit jumped high (find , replace high low if line starts "this: this rabbit jumped low rabbit jumped high sed '/^this/{s/high/low/g}' file will you: kent$ echo "this rabbit jumped high rabbit jumped high"|sed '/^this/{s/high/low/g}' rabbit jumped low rabbit jumped high if want replace word "high" instead of text high: sed '/^this/{s/\<high\>/low/g}' file for example: kent$ echo "this rabbit jumped high highfoo rabbit jumped high"|sed '/^this/{s/\<high\>/low/g}' rabbit jumped low highfoo rabbit jumped high

How to break while loop android server? -

this part of server's code. got problem, can't break endless loop. it's separate class, handle client connections. how it's possible make unlimited quantity of clients connected, finish connection on button click if it's possible? public class handler implements runnable { public void run(){ .... //sockets try{ .... //socket while (true) { client = server.accept(); count++; log.d("my log", "connected"); log.d("my log", "log" + count); executor.execute(new handler(client)); } } } instead of using while(true) use like while(myconditional) { client = server.accept(); count++; log.d("my log", "connected"); log.d("my log", "log" + count); executor.execute(new handler(client)); } where myconditional boolean value can set in ui thread, like button.setonclicklistener(new view.onclicklistener() { public void o

jQuery read JSON one object at a time -

i have potentially extensive list of json list of objects. i'd load each item individually rather of them in 1 large chunk , display loading icon each item being downloaded. can done jquery .get requests 1 json file? jquery has nothing built in this. you could request data using xmlhttprequest , parse partial data when progress event fired , readystate @ least 3 (loading) rather waiting 4 (done). since involve having incomplete, , therefore invalid, json, have implement custom parser this. need strategy dealing partial pieces of data (such half of object or string). you have either count characters or reparse entire set of data each time readystatechange event fired. it far more trouble worth. you'd better off altering server side logic allow paging of data.

javascript - Inject a controller into a running Angular app -

i've written simple code allow bootstrap modals work angular in loads link modal when clicked. links in question have own angular controllers included in source. when modal being loaded first use jquery load it's dependant scripts , have angular compile modal "aware" of it. seems despite fact define controller on-demand modal loaded, angular not "aware" of , throws error (uncaught error: argument 'controllername' not function, got undefined). is there way me tell angular recognize new controller i've added @ run-time? here's modal code i'm using fwiw (prototype code): var directivesmodule = angular.module('modal.directives', []); directivesmodule.directive("modal", function(modalservice) { return function($scope, elem, attrs) { elem.on("click", function(e) { e.preventdefault(); var url = $(this).attr('href'); modalservice.load(ur

php - How to redirect my forms after submitting info? -

i got forms information sent email i'm still having issues forms webpage. when hit submit button, browser doesn't refresh page instead, goes php.file, in displays black page. i'm trying re-direct page form webpage (without using java script). here code far including php file: <form method="post" action="php_email_form.php"> <p style="font-family:arial, helvetica, sans-serif; color:#fff; font-size:12px; font-weight:bold"><label>first name: <input type="text" name="first name" size="30" maxlength="30" style="margin-left:27px" /> </label></p> <p style="font-family:arial, helvetica, sans-serif; color:#fff; font-size:12px; font-weight:bold"

Why do I need Mongoose or Mongojs for Node.js? -

major questions currently i'm confused, main questions are: what use of mongoose/mongojs? different if run node.js without mongoose/mongojs? i can't find explanation of big picture of how mongoose or mongojs fits node.js. mongoose's slogan: "elegant mongodb object modeling node.js" not helping. minor questions btw, think mongoose , mongojs doing same type of thing node.js (i.e. interchangeable), this page seems describing mongojs quite differently mongoose: "simple driver emulates mongodb api as possible." might wrong in putting mongoose , mongojs together. if so, please clarify well. maybe shouldn't use mongojs since stackoverflow doesn't have tag it. if so, ignore said above mongojs. while on topic of giving big picture of node.js mongoose , mongojs, else on this page should know? thanks. if you're not using mongodb, database, there no need have type of driver/odm solution. nodejs run fine without the

regex matching expression notepad++ -

this question exact duplicate of: substring replacement regex notepad++ 1 answer i having trouble regex using notepad++: for single word following equal sign (=), place follows equal sign in quotes. eg: a = bcd becomes a = "bcd" this have giving me problems: s/=\([^" >][^ >]*\)/="\1"/g * using regex search through word document in notepad++ try this: search: (=\s*)(\w+\b) replace: $1"$2"

vim - diff - find specific change between two values in hex dump -

i analyzing hex data binary data dumps basic command-line program of mine. i'm dumping exact contents of struct (a large array of structs, actually) text file. i create second binary dump, , compare 2 files in vim using xxd create binary-to-text representations of original data. both files exact same size in bytes, , i'm trying compare 2 in meaningful way. small change in data before dump file results in large change in other parts of file, due other sections containing hashes, functions based on value changed, , forth. is possible tell diff or vimdiff say, compare 2 files, , show me parts of file in original file (ie: file 1) value set 1 , , in second file, value set 32 ? thank you! i use: diff <(xxd file1.bin) <(xxd file2.bin) this uses process substitution compare output of 2 xxd processes. note still shows line differences, if byte on line different listed. gives nice hexdump-looking comparison. the classical tool however, cmp . so,

How do I trigger a Drupal-Function with Javascript/jQuery? -

i have checkbox different values. when user change checkbox trigger drupal-function field_attach_update http://api.drupal.org/api/drupal/modules!field!field.attach.inc/function/field_attach_update/7 i know how check checkbox-change jquery how can trigger drupal-function then? you'll want check out form api ajax options . think you'll want define ajax['callback'] function calls field_attach_update. <?php function my_form_func($form, $form_state) { $my_checkbox_val = isset($form_state['values']['my_checkbox']) ? $form_state['values']['my_checkbox'] : null; $form['my_checkbox'] = array( '#type' => 'checkbox', '#title' => t('check me'), '#default_value' => $my_checkbox_val, '#return_value' => $nid, // assuming working node, entity '#ajax' => array( 'callback' => 'my_form_field_update_func',

PHP: How to parse a stdClass Object? -

i'm trying parse data returned smartystreets (it's address verification company). here example: array ( [0] => stdclass object ( [input_index] => 0 [candidate_index] => 0 [delivery_line_1] => 3785 las vegas blvd s [last_line] => las vegas nv 89109-4333 [delivery_point_barcode] => 891094333992 [components] => stdclass object ( [primary_number] => 3785 [street_name] => las vegas [street_postdirection] => s [street_suffix] => blvd [city_name] => las vegas [state_abbreviation] => nv [zipcode] => 89109 [plus4_code] => 4333 [delivery_point] => 99 [delivery_point_check_digit] => 2 ) [metadata] => stdc

mysql - Can LIMIT alter results of queries? -

i have database twitter have users , msgs , users can subscribe , block other users. need show msgs subscribed users not blocked, have query this: select distinct m.mid, m.author, m.content msgs m, subs s, blocks b s.uid = 3 , s.sub_uid = m.author , b.uid = 3 , m.author not in (select b2.bl_uid blocks b2 b2.uid = 3) order m.mid desc limit 30; without 'limit 30' query works fine, gives me correct rows, 'limit 30' have wrong results, because query gives me correct rows plus rows belong users subscribed , blocked. how can 'limit' alter result? edit: user has uid = 3 has 2 users subscribed, users 5 , 6, , user 6 blocked, need show msgs user 5, 'limit 30' msgs user 6 returned. just total guess here, find myself wondering if limit clause being applied subquery well, blocking first 30 authors in blocks table. try refactoring query avoid using subquery. as bonus, you'll eliminate performance problems inherent in subquery implement

javascript - Once I remove an attribute I cant add it -

i trying make select checkbox when deselect , select again doesn't select boxes anymore. while work @ first time. this code: html: <div id="everything"> <input type="checkbox" id="all" />select <br /> <br /> <div id="selectthese"> <input type="checkbox" id="first" />first <br /> <input type="checkbox" id="second" />second <br /> </div> </div> js: $(function () { $("#everything").on("click", "#all", function () { var carstatus = $("#all").is(':checked'); if (carstatus == true) { $("#selectthese input").attr("checked", "checked"); } else { $("#selectthese input").removeattr("checked"); } }); }); jsfiddle link: http