Posts

Showing posts from February, 2010

javascript - Create dynamic url from user input -

i running blog: http://jokesofindia.blogspot.com . want provide dynamic link in sidebar of blog download hindi newspaper in pdf format. i tried view source url of epaper.patrika.com , found if enter url epaper.patrika.com/pdf/get/145635/1 download first page , epaper.patrika.com/pdf/get/145635/2 download second page, , on. the last part of url page number. second last part of url, '145635', changes every day. want able enter changing part of url manually every day , have javascript generate download links date replaced information entered. this code needs work on mobile devices such android. you can use html5 data object store data , use js data , append link: html <div class="linkholder" data-number="12345"> <a href="epaper.patrika.com/pdf/get/#/1">pdf page 1</a> <a href="epaper.patrika.com/pdf/get/#/2">pdf page 2</a> </div> js $(document).ready(function() { va...

java - Spin up a report collection node.js app for my executable -

i have java project runs long time since has lot of things churn through (controlling other subprocesses , all). i display progress of executable on webpage can access period of execution of java executable. how spin node.js server java excutable if java executable exits, server knows exit , save report information far somewhere. also, doing others have done before? you set heartbeat (a signal java application), , have node app (as part of data processes java application, or separate message). when there no data, still need send heartbeat. long small message, not impact performance significantly. then set node server shutdown (or restart), , write out exiting data, if heartbeat absent fixed amount of time.

mysql - Error while creating trigger -

delimiter # create trigger update_recharge_due_onrenewal after insert on recharge each row set begin update due_amount set due_amount.amount=due_amount.amount-(select rate internet_package recharge.package_id = internet_package.package_id) due_advance.user_id = recharge.user_id; end;# why showing error - unknown system variable 'begin' change for each row set for each row .

ruby - Can DataMapper still be used for Rails? -

i'm looking use more separated system models in ruby on rails project. looked solution datamapper. however, see none of repositories have been updated in last year, , when installed in rails 4 project, has gem version dependency conflicts newer gems. searching doesn't turn content on using rails 4. what state now? should use it, or else? as uses datamapper every day @ job, recommend sticking activerecord unless connecting legacy database don't control schema of (but consider sequel if case). beyond fact eol (as maintainer stated on mailing list ), many gems need model persistence support activerecord it's rare support datamapper, expect implement support yourself. in experience if find bug know have fix myself due low usage / abandonment of datamapper. as danmanstx mentioned, maintainers focused on ruby object mapper (rom) now, used dm2. although pieces of rom feature-complete, still doesn't have release date afaik (see roadmap ). if @ rele...

c# - LINQ or lambda expression with subquery and NOT IN logic -

this question has answer here: how “not in” query linq? 15 answers i'm trying wrap head around proper syntax linq query or lambda expression returns equivalent following sql query: select * tool t t.uniqtool not in (select t1.uniqtool tool t1 inner join [version] v on v.uniqtool = t1.uniqtool , v.isbetaversion = 1) basically, want list of tools don't have beta version. have tool object has both uniqtool (id value) , boolean property indicating whether version beta. here initial attempt: var tools = t in session.cachedtools !t.isbetaversion select t; i realized gave me wrong result set , got lost trying figure out subquery not in logic. thanks! assuming have navigation property on tool entity query should tools not have version beta: var tools = session.cachedtools.where(t => !t.versions.an...

java - Content assist in web.xml -

the situation work on web project want add filter , servlet web.xml file. example: <servlet> <servlet-name>spring-mvc</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> </servlet> here must enter manually servlet-class element. , same way filter-class element. think it's not convenient. how can auto-complete feature here? eclipse not have content-aware editor web.xml, xml editor content assist driven schema. means no content assist java type values. there effort underway create form editor web.xml appropriate content assist, validation, etc., work not @ point can used. http://projects.eclipse.org/projects/webtools.java-ee-config you may able find commercial plugins web.xml editor if search "web.xml editor eclipse".

.net - I need to accept from input file and that may be of any format in C# . i need to check the format and extract year -

the format yyyymmdd not being accepted , throwing exception tried using string year = datetime.parseexact(usedate, "yyyymmdd", cultureinfo.invariantculture).year.tostring(); do need use date variable ? , how date format yyyymmdd gets processed? i have tested , works fine datetime temp; if (datetime.tryparseexact("20130101", "yyyymmdd", cultureinfo.invariantculture, datetimestyles.none, out temp)) { string year = temp.year.tostring(); }

winforms - SevenZipSharp - how to compress multiple directories into a single file using c#? -

i want compress 3 folders single file using sevenzipcompressor . know how compress single folder . such thing possible ?? thank ! the sevenzipcompressor class provides method called compressfiledictionary() . 1 of method overloads expects file dictionary , file stream. file dictionary ordinary .net dictionary<string,string> . key of dictionary name (or relative path) of file in archive, value of dictionary path file in file system. the key of dictionary allows control structure in 7z archive. example if want compress 3 folders c:\temp\testdir1 |- file1.txt |- file2.txt c:\temp\testdir2 |- file1.txt c:\temp2\test |- file3.txt and resulting structure in archive should be testdir1 |- file1.txt |- file2.txt testdir2 |- file1.txt test |-file3.txt then add files dictonary in following way: dictionary<string, string> filesdic = new dictionary<string, string>(); fi...

javascript - <div> with gaussian blur under it -

i have portfolio website , need make following: i need <div> docked @ left part of page behave "frosted glass" (see http://clip2net.com/clip/m30443/1376076885-clip-147kb.png ) for better understaning of want see http://themespectrum.com/scroll-demo : may see left menu sidebar semi-transparent. need make sidebar "frosted glass", such images sliding under blured inside region of sidebar. blur = gaussian blur i tried everything: svg filters, webkit stuff, different js, jquery didn't want :( apply blur effect once image or div. need continiously, while 1 scrolling images. blur.js looking for! http://blurjs.com/ it works moving divs well, satisfies presupposition! have @ draggable example $('.target').blurjs({ draggable: true, overlay: 'rgba(255,255,255,0.4)' });

haskell - Lowering functions to an embedded language -

how can lower haskell function embedded language in typesafe manner possible. in particular, let's assume have value type like data type t num :: type int bool :: type bool data ty = tnum | tbool deriving eq data tagged t = tagged (type t) t deriving typeable data dynamic = forall t . typeable t => dynamic (tagged t) deriving typeable forget :: typeable t => tagged t -> dynamic forget = dynamic remember :: typeable b => dynamic -> maybe b remember (dynamic c) = cast c and want convert function (issucc :: int -> int -> bool) product of dynamic form , type information, this data splitfun = sf { dynamic :: [dynamic] -> dynamic , inputtypes :: [ty] , outputtype :: ty } such apply function (\(a:b:_) -> issucc b) == apply (makedynamicfn issucc) modulo possible exceptions thrown if dynamic types don't match. or, more explicitly, i'd find makedynamicfn :: funtype -...

html - How to style a button's font in CSS? -

Image
update: seems, issue i'm describing in question affects os x browsers. i change font style of input buttons in css more or less this: input[type="button"] { font: italic bold 3em fantasy; } unfortunately, doesn't work in chrome, safari , opera on os x unless change default background-color , don't want do. see here: http://jsfiddle.net/s7y5b/ so question simple: how can change button's font without changing background color, in way browsers understand? n jsfiddle example above, i'd have button 1 button 2, background color unchanged. how can done? after fiddling it, seems osx change buttons despite normal styling done them. properties such height (even when element set display:block ), font property , padding not rendered. see actual styling, element's border or background must styled. it seems color , width properties render normally.

sublimetext2 - Sublime Text: Changing binding for 'unfold' command -

in sublime text can change key bindings our needs. can't find way overwrite basic binding unfold functionality. have next code in key bindings - user file: { "keys": ["ctrl+keypad4"], "command": "fold" }, { "keys": ["ctrl+keypad5]"], "command": "unfold" }, ctrl+keypad4 works expected, binding ctrl+keypad5 not work @ all. how fix it? don't want change global keymap. you have close bracket in there. should be: { "keys": ["ctrl+keypad5"], "command": "unfold" },

jquery - ENTER (how to block, getting bottom row) -

i have div named "block". editable div (contenteditable="true") when i'm focused div, if press enter cursor gets bottom row. want block thing. want remove getting bottom row function when press enter. is there anyway this? you can prevent listening keydown event , return false. // replace '#block' element id $('#block').on('keydown', function(e){ // e.which returns keycode key pressed // '13' enter key. if(e.which == 13) return false; });

jquery - How to migrate your Twitter's Bootstrap Javascript plugins from version 2.x to version 3 -

twitter's bootstrap 3 released soon. twitter bootstrap bundles javascript plugins. except typeahead plugin migrate twitter bootstrap 3. many other plugin written twitter bootstrap 2.x how migrate them twitter bootstrap 3? related question: twitter's bootstrap datepicker missing glyphicons how use jasny's file upload bootstrap 3 javascript en css download plugin's source code javascript , css (or less) , replace old class references new, see: http://www.bootply.com/bootstrap-3-migration-guide . beside class names changes javascript code should work. html do same html code. or use migrator/updater like: http://twitterbootstrapmigrator.w3masters.nl/ , http://bootstrap3.kissr.com/ , http://code.divshot.com/bootstrap3_upgrader/ or http://upgrade-bootstrap.bootply.com/ glyphicons when plugin use glyphicons: install glyphicons http://glyphicons.getbootstrap.com/ : download files , copy on font files /fonts directory near css. include compiled c...

inno setup - FileCopy and Xdelta doesn't work? -

i've been staring @ innosetup code few hours , can't wrap head around following: -in "procedure curstepchanged" common.dat , common.fat won't copied {app} directory. why? -i copied common.dat , common.fat {app} directory manually testing, xdelta3.exe won't execute in "procedure curstepchanged". parameters xdelta3.exe "-d -s old_file patch_file new_file". xdelta3.exe, common_patch.xdelta , commonfat_patch.xdelta copied right place ({app}). why? what overlooking? [setup] appcopyright=lostprophet appname=far cry 3 magyarítás appvername=far cry 3 magyarítás 1.0 restartifneededbyrun=false privilegesrequired=admin setupiconfile=f:\copy\copy\magyaritasok\progress\far cry 3\installer\fc3_ikon.ico wizardimagefile="f:\copy\copy\magyaritasok\progress\far cry 3\installer\installer.bmp" wizardsmallimagefile="f:\copy\copy\magyaritasok\progress\far cry 3\installer\fc3_ikon.bmp" defaultdirname={reg:hklm\software\wow6432node\...

php - Magento: Mage::registry('current_product') efficient? -

this obvious if know process behind it.. when use mage::registry('current_product') on product page, example, merely referencing "loaded" or loading every time run line of code? in other words, more efficient? (pseudocode below) mage::registry('current_product')->getname() on , on or... $temp = mage::registry('current_product') $temp->getname() on , on calling mage::registry('current_product')->getname() over , on again slightly less efficient $temp = mage::registry('current_product') $temp->getname() on , on but it's not bad i'd super concerned about. if you're setting coding style, pick second. if have bunch of old code former, don't worry performance. the product won't reloaded database when call mage::registry('current_product') — all method return object reference that's been stored on static array of mage class. the reason former less efficient is, ...

mysql - Can data from a subquery be used in the outer query? -

sorry poor question title, i'm not sure if there's name i'm trying do. i have query such following: select a, b, c, (d + e - f) computedvalue, (select sum(column1) table2) d, (select sum(column2) table3) e, (select sum(column3) table4) f, table1 = 1 so, in other words, use integer values returned subqueries compute value. can in php this: $computedvalue = $row['d'] + $row['e'] - $row['f']; but i'm wondering if it's possible in query itself? when tried got following error: error!: sqlstate[42s22]: column not found: 1054 unknown column 'd' in 'field list' you can't use column aliases in clauses of same query, including in select-list. seems puzzling many sql developers, that's standard sql. but can use derived table subquery this: select *, (d + e - f) computedvalue ( select a, b, c, (select sum(column1) table2) d, (select sum(column2) table3) e, (select sum(c...

php - Hiding the decimal if .0 and showing zero if an integer -

i have two, basic number questions. first, using decimal data type on mysql show data speed or height set 1 decimal place decimal(4,1) problem numbers no dp still showing .0 - '309.0' want '309'. need change hide '.0'? second have integer data type showing fixed numbers. many of numbers 0 0 these getting treated null , not displaying. how force 0's display? (i can't make table changes because other columns have zero's null values. 1 column needs zeros display). for both of these problems php being used display results. edit: code i'm using display results. top 1 needs not show .0 bottom 1 needs show zero. length:</b> %sft' . php_eol, $row2['length']) inversions:</b> %s' . php_eol, $row2['inversions']) i believe sneaky trick if add 0 end of number, removes .0000 etc. example: $number = 150.00 $number = $number + 0; //should echo 150 $other_number = 150.500; $other_number += 0; //shou...

ios - does dispatch_async copy internal blocks -

Image
given following (manual reference counting): void (^block)(void) = ^ { nslog(@"wuttup"); } void (^async_block)(void) = ^ { block(); } dispatch_async(dispatch_get_main_queue(), async_block); will "block" copied rather thrown off stack , destroyed? i believe, answer yes. the outer block asynchronously dispatched causes runtime make copy on heap block. , shown below, , described in block implementation specification - clang 3.4 documentation , inner block's imported variables copied heap. in op's example have "imported const copy of block reference". i'm using example in specification: void (^existingblock)(void) = ...; void (^vv)(void) = ^{ existingblock(); } vv(); the specification states copy_helper , dispose_helper functions needed: the copy_helper function passed both existing stack based pointer , pointer new heap version , should call runtime copy operation on imported fields within block. the ...

c# - How can I call the overrided methods of a specific object? -

Image
lets have typical hierarchy this: what want have specific move() implementation every class. if have next code: list<vehicle> vehicles = getvehicles(); foreach (vehicle v in vehicles) { v.move(); } the call has made corresponding move() implementation depending on class of v in runtime i tried virtual , override if call move() in redcar instance, jumps car.move() (i guess because next override under vehicle) any clue how can done? here sample code works. had code handy thought of posting it. public class vehicle { public virtual void move() { console.writeline("vehicle moving"); } } public class car : vehicle { public override void move() { console.writeline("car moving"); } } public class redcar : vehicle { public override void move() { console.writeline("red car moving"); } } class program { static void main(string[] args) { var vehicles ...

java - how to retrieve a line with spaces with comma as separator? -

i have record in game.txt file menard,menard mabunga,0 francis,francis mabunga,0 angelica,francis mabunga,1 i access file , store in array list using code; scanner s = new scanner(getresources().openrawresource(r.raw.game)); arraylist<string> list = new arraylist<string>(); while (s.hasnext()){ list.add(s.next()); } s.close(); and use function load random line; public static string randomline(arraylist list) { return (string) list.get(new random().nextint(list.size())); } when try print result of randomline function using system.out.println(randomline(list)); output mabunga,0 only. now, how can retrieve line spaces comma separator? you reading words instead of lines. use nextline() instead of next() . so, should code: scanner s = new scanner(getresources().openrawresource(r.raw.game)); arraylist<string> list = new arraylist<string>(); while (s.hasnext()){ list.add(s.n...

ruby - Create An Array Class With Certain Operation To Implement -

i working on basic ruby programming project, focuses on creating classes, , operations on classes. have little experience, understand general idea of ruby. my task making array2 class. creating arrays class, perform operations on arrays. methods attempted to-string method, , is-reverse method has 2 array parameters, , tests if first array reverse of second array. here attempt, tried having trouble passing arrays class. believe having calling complications. class array2 def initialize (a) @array = array.new(a) end def to_s return @array end def isreverse (array1,array2) reverasea = array.new reverasea = array1.reverse if (reversea = array2) return "the first array reverse of second array" else return "the first array not reverse of second array" end end end array1 = ["4","5","6","7"] array2 = ["7","6","5","3"] a1 = array2.new(arra...

sql - MySQL 5.6 Error 1054: Unknown column in 'field list' on INSERT -

i'm using mysql workbench create , manage comic book store database. i'm having problem inserting rows comic_issue table. problem i'm having same problem many others posted questions here none of fixes seem working me. here information on comic_title , comic_issue tables. list comic_title table because 'name' column part of composite primary key in comic_issue. mysql> describe comic_title; +-------------------+-------------+------+-----+---------+-------+ | field | type | null | key | default | | +-------------------+-------------+------+-----+---------+-------+ | name | varchar(45) | no | pri | null | | | creator_creatorid | int(11) | no | pri | null | | | isactive | tinyint(1) | no | | 1 | | +-------------------+-------------+------+-----+---------+-------+ 3 rows in set (0.01 sec) mysql> select * comic_title; +----------+-------------------+----------+ |...

linux - Should I put trailing slash after source and destination when copy folders -

i want copy folder: ajax (/home/thej/public_html/jc/ajax) folder: /home/thej/public_html/demo/conf/ final result /home/thej/public_html/demo/conf/ajax , know cp command should like: cp -r /home/thej/public_html/jc/ajax /home/thej/public_html/demo/conf my question is: should put / after ajax , ajax/ ? should put / after conf , conf/ ? i googled online, put '/', not, confused it. i try put trailing / on target. if make mistake , source , target both files rather directories, adding / means i'll error; without / clobber target file. (tab completion add trailing / anyway, it's easier add not.) see volker siegel's answer more details.

Use aSmack on Android to connect the local xmpp server and get "IllegalStateException: No DNS resolver active." -

today implement android client connect local xmpp server,when code executed following code, android app abort, please me: public boolean login(string a, string p){ connectionconfiguration config = new connectionconfiguration("192.168.1.119"); config.setsaslauthenticationenabled(false); config.setdebuggerenabled(false); xmppconnection connection = new xmppconnection(config); try{ system.out.println("hehe"); connection.connect(); connection.login(a, p); //presence presence = new presence(presence.type.available); //presence.setstatus("hehe"); //connection.sendpacket(presence); return true; }catch(xmppexception e){ e.printstacktrace(); } return false; } i got following errors: 08-09 23:30:19.091: e/androidruntime(1860): fatal exception: main 08-09 23:30:19.091: e/androidruntime(1860): jav...

Featured and Promotion Graphic Android play store -

i have been trying figure out promotion , featured graphic shows up. not able find use it. not app uses it. find hd app icon , screen shots. i have looked @ thisisatest , , question . when see android phone via play store, dont see promotion , featured images. when see website, there not able find use of these images. has changed in play store on years (since july 2012) ? the store received major redesign mid-july, 2013, , feature graphic, used provide banner of sorts listing page (and required in order featured) seems have disappeared in process.

Python function which can transverse a nested list and print out each element -

this question has answer here: flatten (an irregular) list of lists 35 answers for example if have list [[['a', 'b', 'c'], ['d']],[['e'], ['f'], ['g']]] function should print out 'a' 'b' 'c' ...ect. on separate lines.it needs able variation in list. my_list = [[['a', 'b', 'c'], ['d']],[[[['e', ['f']]]]], ['g']] def input1(my_list): in range(0, len(my_list)): my_list2 = my_list[i] in range(0, len(my_list2)): print(my_list2[i]) my code doesnt seem work, know missing alot of whats needed neccesary function. suggestions helpful you'll want first flatten list: >>> import collections >>> def flatten(l): ... el in l: ... if isinstance(el, col...

html - What is the point of using absolute positioning in CSS? -

this link says an absolute position element positioned relative first parent element has position other static. if no such element found, containing block <html> so absolute in fact relative. why not use relative instead? there practical use cases can done using absolute positioning not relative? so absolute in fact relative. no, both different, rendering different. a relative positioned element in document flow whereas absolute positioned element out of document flow. are there practical use cases can done using absolute positioning not relative? assume want title on image hover, need position title containing element absolute element holding image has positioned relative . if not assign position: relative; element holding absolute positioned elements, absolute positioned elements flow out in wild. case case 2 (if element not positioned relative , absolute positioned elements flow out in wild) so inshort, can absolute positioned ele...

Maven unpack goal -

i encountered strange problem while using unpack goal . here how is. i have unpack goal defined in parent pom , have multiple child test-projects(modules) not have unpack goal defined in pom's stage 1: execute mvn clean install -dskiptest=true build modules during phase unpack goal executed , have version = release specified zip wish unpack. during unpacking phase version a.b.c unpacked stage 2: when want execute each test execute maven specifying module should executed- why maven again executes unpack goal parent , uses different version i.e. version p.q.r unpacked (which correct version) could throw light on issue. q1 - correct way of executing maven , if yes why there such difference during unpack goal

python - pandas groupby apply on multiple columns -

i trying apply same function multiple columns of groupby object, such as: in [51]: df out[51]: b group 0 0.738628 0.242605 grp1 1 0.411315 0.340703 grp1 2 0.328785 0.780767 grp1 3 0.059992 0.853132 grp1 4 0.041380 0.368674 grp1 5 0.181592 0.632006 grp1 6 0.427660 0.292086 grp1 7 0.582361 0.239835 grp1 8 0.158401 0.328503 grp2 9 0.430513 0.540628 grp2 10 0.436652 0.085609 grp2 11 0.164037 0.381844 grp2 12 0.560781 0.098178 grp2 in [52]: df.groupby('group')['a'].apply(pd.rolling_mean, 2, min_periods = 2) out[52]: 0 nan 1 0.574971 2 0.370050 3 0.194389 4 0.050686 5 0.111486 6 0.304626 7 0.505011 8 nan 9 0.294457 10 0.433582 11 0.300345 12 0.362409 dtype: float64 in [53]: however, if try df.groupby('group')['a', 'b'].apply(pd.rolling_mean, 2, min_periods = 2) or df.groupby('group')[['a', 'b...

html - How to add controls to stringbuilder? -

dim dropdownlist new dropdownlist dropdownlist.id = "ddllist2" dim strb new stringbuilder strb.append("<div id='test1' runat='server'>") strb.append(dropdownlist) strb.append("</div>") strb.append("title") divid.innerhtml=strb.tostring output the page showing "system.web.ui.webcontrols.dropdownlist" can 1 tell me, how add controls stringbuilder?? if want add controls dynamically need use << anycontrol >>.controls.add() method. recommended in pre-init. you can't add control stringbuilder. purpose not rendering server side controls. methods, internally typecast objects string if object not of type string. more information check msdn

algorithm - Whether a given Binary Tree is complete or not -

given binary tree, write function check whether given binary tree complete binary tree or not. a complete binary tree binary tree in every level, except possibly last, filled, , nodes far left possible. source: wikipedia my approach bfs using queue , count no of nodes. run loop till queue not null break once find 1 of below condition holds good: left node not present node left node present right node not present. now can compare count above approach , original count of nodes in tree. if both equal complete binary tree else not. please tell me whether approach correct or not. thanks. this question same of this . wan verify method here. edit: algorithm verified @ boris strandjev below. felt easiest algorithm implement out of algorithms available in net. sincere apologize if not agree assertion. your algorithm should solve problem. what doing bfs entirely equivalent drawing tree , tracing nodes finger top-down , left-right. first...

c++ - How to prevent input text breaking while other thread is outputting to the console? -

i have 2 threads: 1 of them cout'ing console value, let's increments int value every second - every second on console 1,2,3... , on. another thread waiting user input - command cin. here problem: when start typing something, when time comes cout int value, input gets erased input field, , put console int value. when want type in "hello" looks this: 1 2 3 he4 l5 lo6 7 8 is there way prevent input getting put console, while other thread writing console? fyi needed chat app @ client side - 1 thread listening messages , outputs message comes in, , other thread listening user input sent server app. usually terminal echos keys typed. can turn off , program echo it. question give pointers on how hide password input on terminal you can 1 thread handle output.

iphone - Create calendar event from inside my application -

Image
i know there lots of questions , useful answers concerning question on web. tried add calendar event iphone calendar inside application. used code, worked: ekeventstore *es = [[ekeventstore alloc] init]; ekeventeditviewcontroller *controller = [[ekeventeditviewcontroller alloc] init]; controller.eventstore = es; controller.editviewdelegate = self; [self presentmodalviewcontroller:controller animated:yes]; the thing not release calendar controller, because should have said: [controller release] or main.m set autorelease: int main(int argc, char *argv[]) { @autoreleasepool { return uiapplicationmain(argc, argv, nil, nsstringfromclass([...appdelegate class])); } } and if manually release error, have change in main.m? in target's build settings, if see objective-c automatic reference counting using arc: and if using arc not responsible release object self. i recommend read more arc, can start here , important thing should consider if...

css - Media queries management -

i new media queries , have following problem. need fit easy layout (www.spiaggiati.it/antani/) smartphones , tablets in particular (desktop not important application). i've tried in order see (you can check screen.css sheet on website): @media screen , (min-device-width : 320px) , (max-device-width : 480px) (for smarthpones) @media screen , (min-width : 321px) (for smartphone landscape) @media screen , (max-width : 320px) (for smartphone portrait) @media screen , (min-width: 768px) (for tablet , desktop) the problem if edit last part (tablet , desktop) layout on smartphone changes. not catching how media queries work... i not need complicated functionalities, can see layout simple , need adjust height, width , font-size. can me? thank in advance cooperation. please add following meta tag : <meta name="viewport" content="width=device-width, initial-scale=1.0"> for media query details can more info http://stephen.io/mediaqueri...

Authenticate user for secure spring service with CAS RESTful API ticket -

i have successfuly setup cas server. want authenticate user secure service (in spring application), used restful api tickets user. able tickets 2 step call cas/v1/tickets , cas/v1/tickets/{tgt} secure service, when tried call service using generated ticket localhost:8080/secure1?ticket?st-ttyyy..." returns response content of cas login page. i think, missing point in configuration either "services.xml" of spring application or in cas configuration. spring app settings.xml <bean id="pgtstorage" class="org.jasig.cas.client.proxy.proxygrantingticketstorageimpl"/> <bean id="serviceproperties" class="org.springframework.security.cas.serviceproperties"> <property name="service" value="http://localhost:8080/eformrestserver/business/user/10000007" /> <property name="sendrenew" value="false" /> <property name="artif...

python - grabbing keyboard doesnt allow changing focus -

as use display.grab_keyboard, no other window seems know of own focus. with keyboardgrab running can select other windows , send keyevents them, if window text input there no blinking cursor. i read grab_keyboard generating focusevents, doesnt mean blocks focus events, it? what not getting here? from xlib import x,xk xlib.display import display import signal,sys root = none display = none def main(): # current display global display,root display = display() root = display.screen().root root.change_attributes(event_mask = x.keypressmask|x.keyreleasemask) root.grab_keyboard(true, x.grabmodeasync, x.grabmodeasync,x.currenttime) signal.signal(signal.sigalrm, lambda a,b:sys.exit(1)) signal.alarm(10) while true: event = display.next_event() print event.type main() you grabbing keyboard, means keyboard input go program, no other window can receive keyboard input. that's point of grabbing keyboard.

iphone - Implementing countbyenumeratingwithstate for custom UICollectionviewCell -

i building app collectionview filled custom collectionviewcell. i added button "select all/deselect all" supposed affect cell in collectionview. intended use for-loop this: for(customcollectionviewcell* cell in self.collectionview){ // code } however first warning saying: collection expression type "uicollectionview *" many not correspond "countbyenumeratingwithstage:objects:count" and when compile program , click on button, app crash following error message: terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[uicollectionview countbyenumeratingwithstate:objects:count:]: unrecognized selector sent instance 0x7973e00' does have idea on how solve this? many help! don't iterate collection view itself, rather array of cells returns calling visiblecells method on it.

C program over-writing file contents in if statement -

i have c program trying record called "avalanche size". criteria recording if "delta_energy" generated program less equal 0 can increment avalanche size "*avalanche_size = *avalanche_size + 1;" , if delta_energy not less equal 0 continues running loop without incrementing avalanche size. so want write delta energy when avalanche size incremented (not otherwise) file called delta_energies_gsa shown in code below. but find happen if put fprintf statement inside if{ } avalanche size incremented sure, everytime 1 iteration, over-writes entries in file. in end end file containing delta energies 1 of iterations. if take fprintf statemenet , put outside bracket, records gives me delta energies when avalanche size not incremented , don't want those. i thought doing maybe condition "if avalanche size bigger previous avalanche size fprintf delta energy" ... i'm not sure how since avalanche size integer not vector.. any appreciated! tha...

Android: Call Function on Appear -

i have app needs every time brought on screen. in oncreate function, app checks user's settings , performs action. in cases, user need change settings in order proceed. how make app call oncreate function again once user returns app? or better yet, function called when view appears? thank you! this how navigating away app (via button): if(!networkenabled){ alertdialog alertdialog = new alertdialog.builder(main.this).create(); alertdialog.settitle("network location required"); alertdialog.setmessage("please enable network location settings use app"); alertdialog.setbutton("open", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int which) { intent dialogintent = new intent(android.provider.settings.action_security_settings); dialogintent.addflags(intent.flag_activity_new_task); startactivity(dialogintent); } }); alertdialog.show(); } and using onstart this: public void onstart(bundle savedinstancestate) ...

mysql - PDO prepared statement with insertion in database -

please have quetion, have here: $query = $db->prepare('update survey_content set '.$type.' = '.$type.'+1 id = '.$where); $query->execute(); i'm new pdo , don't know how create new query, need add record on database, ok this? $query1 = $db->prepare('insert daily (selected) values (.$type.)'); $query1->execute(); use placeholder , fill value in execute method $query1 = $db->prepare("insert daily (selected) values (?)"); $query1->execute($selected_data); or bind parameter seperately $query1 = $db->prepare("insert daily (selected) values (:sel_dat)"); $query1->bindparam(":sel_dat",$selected_data); $query1->execute();

php - Wordpress Loop - Show posts from custom taxonomy terms in heirarchical order -

ok, here's i'm trying do: i've got custom post type called drinks-menu, taxonomy called drinks-menu-categories, , page template called template-drinks-menu.php. the taxonomy has bunch of terms heirarchical - wine, children white , red; beer, children pilsener, stout, etc... i want use 1 loop display posts these terms in same order they're ordered in admin. here's code i've got far: <?php $post_type = 'drinks-menu'; // taxonomies post type $taxonomies = get_object_taxonomies( (object) array('post_type' => $post_type ) ); foreach( $taxonomies $taxonomy ) : // gets every "category" (term) in taxonomy respective posts $terms = get_terms( $taxonomy ); foreach( $terms $term ) : echo '<h1>'.$term->name.'</h1>'; if ( $term->description !== '' ) { echo '<div class="page_summary...

C-Linux-Any way to pass command "history" to Linux shell? -

i'm writing c program run in linux system. program pass linux commands shell , receive result txt files. system("last >> last.txt"); system("ls -s >>ls.txt"); but failed "history" told me not command buildin. so there way can pass "history" other ones? thanks! you might able invoke built-in command using shell: system("bash -e \"history >> history.txt\""); change "bash" preferred shell.

html - How do i apply scroll for long horizontal background image? -

i have simple html page looong (~8000px width) horizontal panorama image. the image set in css background background-image:url('long_jpg.jpg'); . i need have scrollbar @ bottom of page able scroll whole background image. how can css? can please give working example? check working example http://jsfiddle.net/a9qvt/1/ .panorama { width: 1280px; height: 1024px; background-image: url(http://www.designmyprofile.com/images/graphics/backgrounds/background0188.jpg); }

javascript - Iterate over each sibling element -

context: i'm building form , script perform ajax query, based on clicking specific button. there multiple div blocks elements of same class, , based on div block in which, button clicked, different forms processed. as part of beginning program, have started apparently simple jquery call. i'm trying add onclick event specific class, , trying css value of siblings of element. error: i'm getting error stating typeerror: this.siblings undefined . question: proper way iterate on siblings of element using jquery? my code: html: <a class="btn livestatsbtn"><span class="btn-label">get stats now</span> </a> javascript: $(document).ready (function() { $('.livestatsbtn').click(function(){ this.siblings.each( function () { var tx=this.css(); alert(tx); }); }); }); in jquery event handler, this refers dom element, , not jquery object. have wrap in one: ...

Regarding Events and Delegates in C# -

what side-effects of considering events instances of delegates type? jon skeet says, "events aren't delegate instances.", here. . not have asked if had read anywhere else. i had always, past 2 months, visualized events special type of delegate event keyword helping in preventing nullification of delegate being invoked via event. could please elaborate on how visualize whole concept new c# , event based programming? edit 1: i understood concepts of delegates , consequently events turned out simple concept. go ahead , add example conjured me during battle these constructs. have added lot of comments better understanding. meant new guys me: the library dll: namespace dosomethinglibrary { /* *this public delegate declared @ base namespace level global presence. *the question why need have delegate here? *the answer is: not want implement logging logic. why? well, consumers many *and equally demanding. need different types of loggi...

Tomcat error: java.io.IOException: Server returned HTTP response code: 405 for URL: -

using tomcat. want send string server, have server manipulate string , send back. app crashes whenever try open inputstream on client after have written output stream. server: public void doget(httpservletrequest request, httpservletresponse response) throws ioexception, servletexception{ try{ servletinputstream = request.getinputstream(); objectinputstream ois = new objectinputstream(is); string s = (string)ois.readobject(); is.close(); ois.close(); servletoutputstream os = response.getoutputstream(); objectoutputstream oos = new objectoutputstream(os); oos.writeobject("return: "+s); oos.flush(); os.close(); oos.close(); } catch(exception e){ } } client: urlconnection c = new url("*****************").openconnection(); c.setdoinput(true); c.setdooutput(true); c.connect(); outputstream os = c.getoutputstream(); objectoutputstream oos = ...

python - Tastypie migration error -

i'm trying install tastypie django. have south installed. when migrate weird type error. ./manage.py migrate tastypie running migrations tastypie: - migrating forwards 0002_add_apikey_index. > tastypie:0001_initial typeerror: type() argument 1 must string, not unicode i looked migration 0002 , type isn't being called! it's bug in latest version ( 0.10.0 ). bug report has been submitted. https://github.com/toastdriven/django-tastypie/issues/1005 . you can fix installing previous version: pip install django-tastypie==0.9.16

Wkhtmltopdf tiny pdf when content is long -

i'm trying generate pdf html using wkhtmltopdf (php). i'm not why happens, when html page content long, tiny pdf in image below: http://i.stack.imgur.com/95pxq.png i able solve using word-wrap in css.

c# - visual studio ultimate preview 2013 -

i wanted ask if download visual studio 2013 ultimate preview, need paid when visual studio 2013 released, or 2013 preview of ultimate become disabled etc? or remain free use? regards. if want visual studio 2013 need pay it. preview remain preview.

linux - Calling a shell script from eclipse that requires sudo password -

i need call shell script eclipse deploys python files, however, need pass in sudo password, have managed bring prompt password when running script dont understand how can set root password in sudo command try set nopasswd in /etc/sudoers specific commands <user> all=(all) nopasswd: <cmd1> [cmd2 [cmd3]] to edit /etc/sudoers have use: sudoedit /etc/sudoers

ruby on rails - Couldn't find file 'jquery', Sprockets::FileNotFound in StaticPages#home error -

i self-studying michael hart's guide , stuck in chapter 7. when go localhost:3000 , error message comes up, saying couldn't find file jquery , points line 7 in application.html.erb file . when delete line 7, -> <%= javascript_include_tag "application", "data-turbolinks-track" => true %> , localhost runs normal without error. my git repository . i solved reverting to gem 'jquery-rails', '2.1.4' gem 'jquery-ui-rails', '4.2.1'

c++ - QToolTip shows up in the wrong cordinates -

i have qcustomplot , show qtooltip on mouseover component. here using. slot. void customplot::displayplotvalue(qmouseevent* val) { qtooltip::showtext(val->pos(), "a tool tip"); } however tool tip aappears in wrong cordinates (its infact out of form has component) . suggestion on might doing wrong ? use qwidget::maptoglobal map coordinates relative widget global coordinates, relative whole screen: qtooltip::showtext(widget->maptoglobal(val->pos()), "a tool tip"); where widget qwidget.

image - CSS - issue in Safari -

in smaller browser window css moves in safari appears fine in other browsers except safari take @ http://tinyurl.com/mvkkcfg ? in chrome firefox - compare in safari i need or image stay in same spot no matter browser or window size used here code im using <div style="z-index:10; position:absolute; margin-top:400px; margin-left:335px"> <img src="http://173.83.251.7/~iworeitb/wp-content/uploads/2013/06/or.png" alt="" /> </div> just tried option 2 i changed code follows still no luck on position other suggestions? <div id = 'o' style="z-index:10; position:absolute; margin-top:20%; margin-left:18%"> <img name="" src="http://shopiworeitbe.../2013/08/or.png" alt="" /></div> #o{ height: 100%; max-height: 100%; overflow: auto; width: 100%; http://tinyurl.com/mvkkcfg still not accurate please thanks you have ...

charts - Hide zero XAxis date value -

i have system.windows.forms.datavisualization.charting.chart 3 values , assiciated same date (15.07.15). looks @ the picture . there way hide "zero" "30.12.1899" date? .labelstyle.enabled = false; it hides axis lables. hide "zero" set .axisx.minimum 1e-12;

eclipse - Problems with XmlPullParser code inside an AsyncTask (Activated By Button Click) -

so have program have been working on while. however, stuck on method uses xmlpullparser , method called getallxml() . inside of doinbackground() method of asynctask . asynctask subclass of activity called formactivity . when run code. here code supposed do. after user selects "cloverfield" previous activity. xml file called cloverfield_in.xml called setcontentview() . user presses button on same xml file. clicking button executes asynctask called madlibasynctask . within asynctask 2 methods, doinbackground() , onpostexecute() . (i don't know if need onpreexecute() ...within have have progress bar....but without method figure program shouldn't crash way does). within doinbackground() method, calling method called getallxml() . method uses xmlpullparser search through current xml ( cloverfield_in.xml ) , capture text single textview . code getallxml() follows. public void getallxml() throws xmlpullparserexception, ioexception{ activit...