Posts

Showing posts from June, 2015

php mysql query looping too many times on page load?? -

i running query "forename" , "surname" of "manager" in mysql below - query works fine in mysql when test (it returns 1 result) when page loads on browser name appears more 10,000 times! not sure doing wrong - appreciated, thankyou. <div id=""> <? $query3 = "select * `lf`.`weekly_report` inner join `lf`.`user_account` on `lf`.`weekly_report`.`manager` = `lf`.`user_account`.`user_id` (date >= curdate( ) - interval dayofweek( curdate( ) ) +6 day) , (date < curdate( ) - interval dayofweek( curdate( ) ) -1 day) , `p_code` = '" . $pcode . "'"; echo "<table border=1 cellpadding=5 width=30% style='border-collapse:collapse; height:auto; font-size:small; float:left;'>"; echo "<tr>"; echo "<th style='background-color:#ffffcc;'>project manager</th>"; while ($row2 =...

c# - How to query the average from a certain property in an Entity and return it in a List of List of objects in LINQ? -

my entities designed in entity framework this: event eventid date acceleration intensity deviceid blockid device block block blockid datestart dateend events device deviceid alias clusterid cluster events cluster clusterid name devices regionid region regionid name clusters an event belongs block , registered device. device belongs cluster , cluster belongs region. what i'm trying average acceleration , average intensity of events in block, organized in objects in list, these objects must organized depending if want averages of events of block detected devices in every cluster or every region. what kind of query in linq should use? to make more clear, these sql string represent actions want perform select avg(e.intensity) average blocks b, events e, devices d, clusters c, regions r b.blockid = 1 , b.blockid = e.blockid , e.uniqueid= d.uniqueid , d.clusterid = c.clusterid group c.clusterid; select avg(e.intensity) aver...

c++ - Read and Write to Windows pipes in separate threads -

in program start thread redirect output console: while(true) { if (!readfile(hpiperead,lpbuffer,sizeof(lpbuffer), &nbytesread,null) || !nbytesread) { if (getlasterror() == error_broken_pipe) break; // pipe done - normal exit path. else displayerror("readfile"); // bad happened. } // display character read on screen. if (!writeconsole(getstdhandle(std_output_handle),lpbuffer, nbytesread,&ncharswritten,null)) displayerror("writeconsole"); } the problem is loop. possible to avoid run of loop making thread wait until appears in pipe? the problem becomes more intense when there analogous thread writing.

python - Is there anyway to know what object does the file have in MS powerpoint or word -

i use win32com handle office document in python. there no way know method object have in win32com. (in general, can fetch properties or methods dir(obj) in python ) so, if want know properties or methods powerpoint document have , go msdn however , have powerpoint file contains lots of object. don't know name or type it. for example ,when want access text in powerpoint can use presentation.slide.textframe.textrange.text access it. how formula??? if want access it? there anyway when click mouse on object in powerpoint file, , show type of object is? thanks in advance. for first question want use makepy utility create early-bound objects can introspect them (ie. press tab , @ methods in ide). cut down searching on msdn 95% easiest way go pythonwin (installed win32com) , go tools > com makepy utility , select com library want use (in case 'microsoft powerpoint 14.0 object library'). let run , set. described here . for second question, david point...

css - Facebook Like social plugin sizing issues -

i using facebook social plugin on website, , every time page loads, plugin stretches height of div in until plugin has loaded. i did define height of div social plugin in, though height stayed same, still see shift. using twitter , google plus social plugins - makes shift more noticeable since shifted (shift under h3 heading). .socialbookmarks {margin:30px 0;padding:5px 15px;overflow:hidden;} .socialbookmarks .social-wrap {display:inline-block;vertical-align:middle;} .social-wrap .ezimagebox {float:left} <div class="socialbookmarks"> <h3 class="inline-block">share:</h3> <div class="social-wrap clearfix"> <div class="ezimagebox"> (loads twitter social plugin) </div> <div class="ezimagebox"> (loads google plus social plugin </div> <div class="ezimagebox"> (loads facebook social p...

css - Collapsed Bootstrap accordion panels expanding outside DIV when opened -

i'm using accordion featured part of bizstrap responsive website theme. default bottom panel open. the settings accordion per template, other setting class , height panels closed: <a href="#collapseone" data-parent="#accordion2" data-toggle="collapse" class="accordion-toggle collapsed"> panel title</a> </div> <div class="accordion-body collapse" id="collapseone" style="height: 0px;"> <div class="accordion-inner"> the development page here. i tried have set first panel open. problem in instance when panels below top 1 opened, top panel remains open , content second panel extends outside of container div. strangely if clicked on top panel first, , ones below accordion functioned correctly. class 'accordion-toggle e' , height set 'auto'. development page here. i've not set accordions using bootstrap , having tough time getting head around it...

javascript - jquery last child border if..else -

html <div class="aa"> <div class="bb">1 </div> <div class="cc">a </div> </div> <div class="aa"> <div class="bb">2 </div> <div class="cc">b </div> </div> jquery $('.bb:last').addclass('red'); $('.bb').click(function(){ $(this).next('.cc').fadetoggle(); if(!$('.cc:last').is(':hidden')){ if($('.bb:last').hasclass('red')){ $('.cc:last').addclass('red'); $('.bb:last').removeclass('red'); } }else{ $('.bb:last').addclass('red'); } }); online sample -fiddle when click box 2 border should removed bb assigned 'cc', second click border should go bb whenever cannot right. else{$('.bb:last').addclass('red');} not working. co...

ios - Remove a custom MKOverlayView -

i'm using subclassed mkoverlay , subclassed mkoverlayview display wms tiles. got running well. i'm running issue of removing mkoverlayview when i'm done displaying tiles. can remove mkoverlay fine: -(void)removewmsoverlay { (wmsoverlay *overlay in self.mapview.overlays) { if ([overlay iskindofclass:[wmsoverlay class]]) { mkoverlayview *test = [self.mapview viewforoverlay:overlay]; [self.mapview removeoverlay:overlay]; } } } but wmsoverlayview still there , still running code (constantly checking if new tiles can draw) creates lag. i don't know find list of mkoverlayviews active. tried: -(void)removewmsoverlay { (wmsoverlay *overlay in self.mapview.overlays) { if ([overlay iskindofclass:[wmsoverlay class]]) { mkoverlayview *test = [self.mapview viewforoverlay:overlay]; [self.mapview removeoverlay:overlay]; [test removefrom...

applescript - How to create a custom key modifier in Mac OS X for Custom Keyboard -

i'm buying keyboard logitech: logitech tablet keyboard android. want use macbook. the keyboard not have "command" key on it, have "search" key replacement "command" key before "space bar" key , after "alt" key. "search" key not work "command" key, not identified in mac keyboard preference. so try use keyboard maestro, cannot found feature remap "search" key "command" key. try use apple script in keyboard maestro in below screenshot, it's not working expected. when press "search" key + "z" guess should behave "command" + "z", did not, should press "search" key twice "a", "command" event still pressed cannot type after that. is there way make "search" key remapped "command" key? http://dl.dropboxusercontent.com/u/1550865/keyboard_maestro.png http://dl.dropboxusercontent.com/u/1550865/keybo...

session - Methods on passing code from one php page to another -

i'm sorry if simple question, i'm new php! anyhow, issue following: have few lines of code on 1 page, in use mysql, html , php, , pass onto php page. thinking @ first use $_session, while worked text/variables, didn't work more extensive code. i'm supposing it's not made that. other alternative had thought of use include/require functions, mean taking entire page of code, although need small portion of it. options? for example, if had following: <html> <table> <td><select name="example"> <?php while ($example_variable=mysqli_fetch_array($example_mysql_select)){ echo "<option>" . $example_variable['field'] . "</option>"; } ?> </html> ... wouldn't work session. have alternatives, or stuck require/include? there ways of getting session it? thanks lot in advance. try serializing it: $_session['var'] = serialize($var); then access with: $var = u...

c++builder - C++ Builder - File transfer -

i using embarcadero c++ builder , trying collect information can can start making program. want make client/server program. going use databases , need way transfer database client computer server computer. , if client pc gets destroyed real need send client database back. how can this? i'm assuming you'll using firebird database, since it's default c++builder/delphi. firebird maintains database in single file, need transfer network components, indy , great socket library comes c++builder. here article data transfer through network delphi (easily translatable c++). luck!

java - What is wrong with my if condition? -

i've been trying figure out 3 hours. believe syntax correct method isn't working. class takes arraylist of type point2d (class defined) holds x , y elements of point. attempting order arraylist ascending point sizes (ex. (200, 200), (200, 400), (400, 200), (400, 300), (400, 400)...etc, sort x points, y points). if condition in loop of indexofsmallest smallest, if correct should working, sort x values correctly. ideas? thank in advance!! import java.util.arraylist; public class point2dselectionsort { public point2dselectionsort() { } public static void sort(arraylist<point2d> a) { int index, index2,indexofnextsmallest; (index = 0; index < a.size( ) - 1; index++){ indexofnextsmallest = indexofsmallest(index, a); interchange(index,indexofnextsmallest, a); } //a.get(0), a.get(1),...,a.get(index) sorted. } /** * precondition : , j l...

extjs - how to embed one html page in extjs4 -

i started extjs 4, current problem: insert html code. here need insert code 'items'. lack of experience should not done. looking forward receiving people "here code" ext.define('mydesktop.mytree', { extend: 'ext.ux.desktop.module', requires: [ 'ext.tree.panel', 'ext.data.treestore', 'ext.form.field.htmleditor', ], id:'tree', init : function(){ this.launcher = { //title text: 'my computer', //icon iconcls:'notepad' }; }, createwindow : function(){ var desktop = this.app.getdesktop(); var win = desktop.getwindow('tree'); if(!win){ win = desktop.createwindow({ id: 'tree', title:'mycomputer...

jQuery this selector not available to animate() method properies -

can explain me why "this" selector not available animate() methods properties. see 1st example @ http://jsfiddle.net/qzvv4/ , there no errors produced ignores it. $('#test1 .bar[data-percentage]').animate({ width: $(this).attr('data-percentage'), easing: 'easeoutbounce' }, 1000, function () { $(this).text($(this).attr('data-percentage')); }); because this isn't referring element. you're still in same scope, this doesn't change. you'd have instead: // need easing plugin // https://github.com/danro/jquery-easing $('#test1 .bar[data-percentage]').each(function() { var $this = $(this); $this.animate({ width: $this.data('percentage') }, { duration: 1000, //easing: 'easeoutbounce', step: function(value) { $(this).text(value + '%'); } }); }); demo: http://jsfiddle.net/qzvv4/4/

drop down menu - How can I change the dropdownlist's options? -

i'm newbie in asp.net i'm hoping give me on dropdownlist bound table. here's scenario: i have table account fields userid, username , type. type field contains 3 items: 's', 'a', , 'u'. each user has own type. have dropdownlist named 'ddltype' bound on account table. however, want options of dropdownlist displayed 'stakeholder', 'approver', , 'user' instead of displaying letters/initials only. since not prefer making changes in database, how can change options through code behind? here's code: public void bindcontrols(int selecteduserid) { datatable dtaccount = null; try { dtaccount = logbal.getaccountdetails(selecteduserid); if (dtaccount.rows.count > 0) { lbluserid.text = dtaccount.rows[0]["userid"].tostring(); txtusername.text = dtaccount.rows[0]["username"].tostring(); ddltype.selectedvalue = dtaccount.rows[0]["type"].tost...

apache camel - What does 'moveFailed' really do? -

i want create file input behaves follows: process exchange attempt copy input file shared drive if step (2) fails (e.g. share down) move local file instead following doc 'movefailed' parameter allows "set different target directory when moving files after processing (configured via move defined above) failed". sounds movefailed cover step (3). the following test, fails...what doing wrong ? using camel 2.10.0.fuse. package sandbox.camel; import java.io.file; import org.apache.camel.endpoint; import org.apache.camel.builder.routebuilder; import org.apache.camel.component.mock.mockendpoint; import org.junit.test; public class movefailedtest extends org.apache.camel.test.junit4.cameltestsupport { private string faileddir = "move-failed"; @override protected routebuilder createroutebuilder() throws exception { return new routebuilder() { @override public void configure() throws exception { ...

java - Can't show HTML + SVG -

i used use jeditorpane , can display html, cannot display svg, , nested svg html cannot complete display. then use jsvgcanvas , can display svg, cannot display html. is there way solve problem? configure jeditorpane use jsvgcanvas canvas svg. achieve that, need specialist htmleditorkit . here htlmeditorkit of appleteer . package org.pscode.ui.applet.appleteer; import java.awt.component; import java.awt.dimension; // placeholder component import javax.swing.jbutton; import javax.swing.text.html.html; import javax.swing.text.html.htmleditorkit; import javax.swing.text.view; import javax.swing.text.componentview; import javax.swing.text.plainview; import javax.swing.text.viewfactory; import javax.swing.text.element; import javax.swing.text.attributeset; import javax.swing.text.styleconstants; import org.pscode.ui.applet.appleteer.appletelement; import org.pscode.ui.applet.appleteer.appletloadercontainer; import java.util.hashmap; import java.util.enumeration; ...

ruby - getting an undefined method error from "_user.html.erb" in Rails 3 -

if getting error undefined method impressionist_count' nil:nilclass after trying use line inside _user.html.erb <%= @user.impressionist_count+@user.microposts.sum(&:impressionist_count) %> where need defined? have inside user.rb def impressionist_count impressions.size end i tried in various helpers no avail when "render @users" each user accessible partial local variable "user". partial should like: <%= user.impressionist_count+user.microposts.sum(&:impressionist_count) %>

jquery - javascript profanity filter on a contenteditable div -

i working on site filters bad words on array. whenever user types word on textbox, alert box appears if word array found. i'd same instead of using textbox, i'd use contenteditable div. i'll needing jquery on there seems conflict on code since initial code done in pure js. fiddle link: http://jsfiddle.net/br7td/ here's javascript: var swear_words_arr=new array("bad","evil","freak"); var swear_alert_arr=new array; var swear_alert_count=0; function reset_alert_count() { swear_alert_count=0; } function validate_user_text() { reset_alert_count(); var compare_text=document.form1.user_text.value; for(var i=0; i<swear_words_arr.length; i++) { for(var j=0; j<(compare_text.length); j++) { if(swear_words_arr[i]==compare_text.substring(j,(j+swear_words_arr[i].length)).tolowercase()) { swear_alert_arr[swear_alert_count]=compare_text.substring(j,(j+swear_words_arr[i].length)); ...

bigdata - splunk vs cordys operations intelligence -

can cordys operations intelligence (coi) alternative splunk? i have not used coi, looking @ videos , documents seems similar splunk can in terms of providing operations intelligence real time big data. conceptually cordys operations intelligence (coi) , splunk differ in way coi uses excel calculation engine. in coi, real-time data fed (existing) excel sheet , results can visualized , monitored in applications sharepoint. splunk has own indexed data store , calculation engine. means business user or domain owner needs learn new tool in stead of using known office applications excel , sharepoint. (author works @ cordys)

Adobe CQ5.5-How to display Page Thumbnail using API -

i have configured image page using sidekick >page properties>images tab. want fetch page image(thumbnail) in 1 of jsp. can give me pointers or code snippet api class , method can use achieve this. thanks, rajeev i suggest using default image component example - /libs/foundation/components/image. if you're putting code component specific page type though, code should this: if (currentnode.hasnode("image")) { string imagepath = currentnode.getnode("image").getpath(); resource imageres = resourceresolver.getresource(imagepath); image = new image(imageres); image.loadstyledata(currentstyle); image.setselector(".img"); if (!currentdesign.equals(resourcedesign)) { image.setsuffix(currentdesign.getid()); } image.draw(out); } keep in mind though, though set image, not mean show - if you're using default page dialog page properties, show broken image. that's because there bug in cq s...

java - Datagramsocket: how receive(...) handles fragmentation of a packet -

i came know professor that, datagram packet sent using udp socket gets fragmented in lower layers , may arrive multiple packets @ receiver end. e.g, if send 1000 bytes data in datagram packet, @ receiving end might arrive as, 2 bytes, 500 bytes, 12 bytes, , on. therefore, suggested multiple receive(...) receive entire 1000 byte packet sent sender. later when went through java documentation datagram socket receive(...) , there line reads follows: "this method blocks until datagram received. ..." mean entire datagram packet received , don't need multiple receive (even though it's case in theory) when use java? pls. clarify. if multiple receive(...) each packet option around problem, pls. give suggestions on how this. any call receive() give entire packet - fragment handling happens in 2 layers below socket. fragmentation , defragmentation happens in network/internet layer ( ip ), socket never see fragments receive entire , full udp/tcp packets (only...

android - google map view version 2 in activity group -

hello have tab based application containing activity groups . in 1 activitygroup have sub activity , in have display map , plot multiple location getting response server , google map version 1 no more supported have use oogle map version 2 when ever use xml given below xml inflate infalte fragments java.lang.runtimeexception: unable start activity componentinfo{com.teks.googlemaps/com.teks.googlemaps.mainactivity}: android.view.inflateexception: binary xml file line #13: error inflating class fragment <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_centervertical="true" /> <fragment android:id="@+id/map" ...

html - Make div act as a frame -

Image
i've got following html group. <div id="item-groups"> <!-- section select product types --> <div class="item-group-button"> <!-- item group selection button --> <h3>beverage</h3> </div> <div class="item-group-button"> <!-- item group selection button --> <h3>tobacco</h3> </div> </div> i've designed following css above elements.. #item-groups{ height: 75px; } .item-group-button{ width:130px; height:40px; float:left; margin:17px 0px 0px 20px; border-radius:10px; background:#4e5154; } .item-group-button h3{ padding:0px; margin:8px 0px 0px 29px; color:white; } how can design css item-groups div can act frame. explain little bit, item-group-butons loaded db , amount of elements dependent on number of db records. when elements exceed limit, excess elements go out of order. how can stop this? went through method making other el...

iphone - AVCaptureSession With STT(Speech to text) -

i using avcapture session record video same time using stt ( google speech text api ) convert voice text. have facing problem when click on speak button camera freezes. correct answer acceptable. in advance . to start camera in -(void)viewdidload; if ([[self capturemanager] setupsession]) { // create video preview layer , add ui avcapturevideopreviewlayer *newcapturevideopreviewlayer = [[avcapturevideopreviewlayer alloc] initwithsession:[[self capturemanager] session]]; uiview *view = [self videopreviewview]; calayer *viewlayer = [view layer]; [viewlayer setmaskstobounds:yes]; cgrect bounds = [view bounds]; [newcapturevideopreviewlayer setframe:bounds]; if ([newcapturevideopreviewlayer isorientationsupported]) { [newcapturevideopreviewlayer setorientation:avcapturevideoorientationlandscapeleft|avcapturevideoorientationlandscaperight]; } ...

Reading and processing WAV file data in C/C++ -

i'm doing very important school project. need extract information of wave file in c/c++ , use information obtain lpc of voice signal. but, in order that, need pre-processing signal, doing 0 crossing , energy analysis, among other things. means need sign , real value. problem don't know how obtain useful information , correct format that. have read every single field in file, i'm not sure doing right. suggestions, please? this way read file @ moment: readi = fread(&bps, 1, 2, audio); printf("bits per sample = %d \n", bps); thanks in advance. my first recommendation use kind of library out. sound solutions seem overkill, simple library (like 1 recommended in comment of question, libsndfile ) should trick. if want know how read wav files can write own (since school might turn nose @ having use library other regular person), quick google search give info need plus people have wrote many tutorials on reading .wav format . ...

html - asp classic and select tag with multiple attribute -

i using select tag of html , having multiple attribute. , fetching of selected option select tag using asp classic. getting 500 internal server error. <% response.write(request("evtcategory").count) response.write(request("evtcategory")) %> <form id="frmsearch" method="post" > <select name="evtcategory" multiple> <option value="0">--select category--</option> <option value="1">first</option> <option value="2">second</option> <option value="3">third</option> <option value="4">fourth</option> <option value="5">fifth</option> </select> <input type="submit" value="search" /> </form> i don't think count exists in classic asp, looks asp.net code. multiple selected values returned comma separated string. you ca...

VHDL Verilog Integer Arrays Ports -

i working on project fpga implementation of breakout game. in game, have break bricks using ball , paddle. bricks may break on multiple contacts ball. this, using integer array represent number of hits required break particular brick. eg (2,0,1,2) represents brickk needs 2 hits broken followed broken brick followed brick needs single hit broken et al. also, have done coding in vhdl in order output results onto vga screen, using verilog. in vhdl, have declared type integer array in package follows: package mytypes_pkg type int_array array (0 39) of integer; end mytypes_pkg; then in ball motion controlling file, have imported work.mytypes_pkg.all , have: brickout:out int_array; which contains current state of bricks in game. array has passed verilog file vga display generation has take place. there, tried input [39:0] bricki; but gives me error "different types port 'brickout' on entity , component 'mainc'" how can rectify error , ...

sql - Optimize Hibernate HQL SELECT with IN clause -

please how can optimize query? from orderentity id in (select distinct orderid productentity code = :mycode or extcode = :mycode) this query slow tables has around million rows order 1 ... * product thank help edit in pure sql use query fast, don't know how form in hql: select * order o, (select distinct order_id product code = 'abc' or ext_code = 'abc') p o.id = p.order_id i guess productentity can mapped association orderentity (foreign key order_id) . if true, try map , test query (inner join may faster) : select o productentity p inner join p.orderentity o p.code = :mycode or p.extcode = :mycode

node.js - expressjs req and res object parameter about safe -

i use express write app, want implement variables current_user in global, ensure whether user logined.so, add middleware app.use(require('./controller/user').auth_user); in user.js, define method called auth_user use res.locals set global local current_user. , set req.session.user=user. exports.auth_user = function(req, res, next) { if (req.session.user) { res.locals('current_user', req.session.user); return next(); } else { var cookie = req.cookies['user_cookie']; if (!cookie){ res.locals('current_user', ""); return next(); }; var auth_token = decrypt(cookie, 'user_session'); var auth = auth_token.split('\t'); var user_email=auth[3].tolowercase(); user.findone({'email': user_email},function(err, result) { if(err) return next(err); if (result) { req.session.user = result; res.locals('current_user', req.session.user); return next(); }else{ ...

EXTJS - Ext.require and onReady() for inner scripts -

i have app.js file loaded main html file. app.js file upon click of links defined in it, dynamically loads second js file using ext.require(). loading happens ok have defined ext.loader.setpath() etc, second script contains lines such ext.require() import ui libraries , followed onready(), problem onready never fired, , cannot put widget rendering code outside onready(). onready works synchronous loading of scripts? thanks much onready ever fire single time application. if @ docs you'll see ext.require() can take callback function: ext.require('my.foo.bar', function() { console.log('do something'); }); http://docs.sencha.com/extjs/4.2.0/#!/api/ext-method-require

java - Table does not exist error despite I have it -

when use entity manager commit got following error: entity title exist , doesnt have error reason error table/view 's1_manager' not exist. happen when did commit. entitymanager.gettransaction().commit(); @entity @table(name = "s1_manager") public class manager { @id @column(name = "title_id", length = 128) private string id; btw, table exist in persistence xml. ensure table existing on database user/schema connecting to. to have tables automatically created see, http://wiki.eclipse.org/eclipselink/examples/jpa/ddl

Querying documents with arrays in MongoDB -

i have document has array property contains ids of documents stored in collection, below: movie: { title: 'a title', genres: ['id_1', 'id_2', 'id_3', 'id_4' ] } now want pull related genres 1 query specified movie. possible mongodb driver c# using query.all() ? as mongodb not support joins , there no way drivers of c# going you. ( https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/uuqikhcxp4o ) . in case joining on client side , slow. try change document structure , if possible use sub-document of genres make advantage of mongodb. 1 of suggestion can give , if have places show small information genres , id store more information not , while showing movie can pick document , show them , give link in case want more . more on : mongodb , "joins" movie: { title: 'a title', genres: [{id : 'id_1' , "name" : "classic"}, {id :'id_2' , "name" : "roma...

asp.net - PageIndexChanging in gridview wont fire -

i downloaded free template internet , using in project of asp.net. have gridview , using paging because of template pageindexchanging event wont fire. there alternate because data in gridview large , gridview getting long , out of template. please assist. if can please let me know if event can fire on button click. urgent please.... thnx in advance.. my .cs code is: protected void gridview1_pageindexchanging(object sender, gridviewpageeventargs e) { gridview1.pageindex = e.newpageindex; emp(); } try this....... protected void gridview1_pageindexchanging(object sender, gridviewpageeventargs e) { gridview1.pageindex= e.newpageindex; emp(); } set property in aspx file........ allowpaging = true pageindexchanged = gridview1_pageindexchanged

html - Browser request to server only one stylesheet or all css files(Which is @import in main stylesheet)? -

i have tried "@import" importing css files within single "style.css" use on main html file in head tag "link href". use firebug inspect elements , see "style.css" applied it, wanted know browser request server 1 time "style.css" or every css @import in "style.css" components include in "style.css"? this components include in "style.css" @import url("main.css"); @import url("colorzilla.css"); @import url("mainbox.css"); article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; } audio:not([controls]) { display: none; } [hidden] { display: none; } html { font-size: 100%; overflow-y: scroll; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } body { margin: 0; font-size: 13px; line-height: 1.231; } body, button, input, select, textarea { font-fa...

regex - Pattern matching for characters, comma and semicolon -

i trying pattern match against textbox input field. the entered text should consist of characters separated ',' or ';' followed optional space. example: jane, doe , jane,doe , jane,doe; jack,black , jane,doe;jack,black valid. jane doe , (leading space)jane , doe(trailing space) invalid. the current pattern have is, /^[a-za-z]+(,;)?$/ please help. how this: /^[a-za-z]+([,;]\s?[a-za-z]+)*$/

sql - MYSQL Query - When col1 has only 'Special' use that else use one of the other -

following dataset id | description | type ------------------------------- 12204 | abc | special 12204 | def | connector 12541 | ghi | special 12541 | jkl | special 12541 | mno | hybrid 13292 | pqr | resistor 13292 | stu | connector 13292 | vwx | hybrid 14011 | yza | special 14012 | bcd | resistor what want following: id | description | type ------------------------------- 12204 | def | connector 12541 | mno | hybrid 13292 | pqr | resistor or connector or hybrid <-- doesn't matter 14011 | yza | special 14012 | bcd | resistor so, need whole dataset according type. if there "special" type possible, need use it, if not want use 1 of others. i figured out group uses first row contains special... my query far: select id, description, type anydatabase group id having count(type) > 1 hope can :) adi you can try this ...

ios - File cached status without downloading - Dropbox Sync API -

i show user list of dropboxed files , whether cached on device or have downloaded first. the way tried iterate result of listfolder (dropbox sync api, ios) , open files dbfilestatus. opening files, start download. is there way information without downloading files? thanks manuel

Named stages as git checkout-index parameters -

git checkout-index --help says --stage=|all instead of checking out unmerged entries, copy out files named stage. must between 1 , 3. note: --stage=all automatically implies --temp. i understand "named stages" corresponding numbers 1 3? the git merge manpage eplains: for conflicting paths, index file records 3 versions: stage 1 stores version common ancestor, stage 2 head , , stage 3 merge_head (you can inspect stages git ls-files -u ). working tree files contain result of "merge" program; i.e. 3-way merge results familiar conflict markers <<< === >>> .

asp.net - How to fix encoding issue without rewriting the text again? -

i face following problem : i have .aspx page when copy gridview page ,i encounter following problem : i have arabic words : رقم اذن الإضافة it has turned : &#1585;&#1602;&#1605; &#1575;&#1584;&#1606; &#1575;&#1604;&#1573;&#1590;&#1575;&#1601;&#1577; my master page meta data : <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> how fix problem all arabic data have turned strange characters , numbers!! in design time ,however in run time every thing goes okay . but when try edit , take lot of time detect right control ! how fix problem without rewriting these arabic characters again ? you need use utf-8 or windows-1256 encoding show properly, see example what character encoding should use web page containing arabic text? utf-8 okay?

html5 - Single page fixed viewport -

i making single page scrolling vertical site has viewport locked @ 100% height. the problem have designs given me calculated 1200x800 (macbook 13") view using 1920x1080 (macmini) resolution. furthermore, usable height area in each screen limited each widget browser uses 800 might example 638 height (it more profound in ipads 768 browser height in total not 768 @ all). also, design must centered in width , height. width , can use margin:0 auto , height trickier because need make div absolute. what did far make div absolute , have manipulated javascript, know if there pure css way it since javascript require cases , excess code. this i'm using body height , html height @ 100% <div style=" display:table;width:100%;height:100%"> <div style="display:table-cell;vertical-align:middle;"> </div> </div>

ios - Cannot animate CALayer strokeColor -

i've been trying draw simple rectangle , animate edge color. tried using following link , still doesn't help. fixed changing layer's border color , animating same. worked fine. is there kvo strokecolor because i'm getting working backgroundcolor of layer. i'm on xcode 4.6 running ios sdk 6.1 this i've been doing: cgcontextref context = uigraphicsgetcurrentcontext(); cgcontextsetlinewidth(context, 2.0); cgcontextsetstrokecolorwithcolor(context, [uicolor bluecolor].cgcolor); cabasicanimation *strokeanim = [cabasicanimation animationwithkeypath:@"strokecolor"]; strokeanim.fromvalue = (id) [uicolor redcolor].cgcolor; strokeanim.tovalue = (id) [uicolor greencolor].cgcolor; strokeanim.duration = 3.0; strokeanim.repeatcount = 0; strokeanim.autoreverses = yes; [self.layer addanimation:strokeanim forkey:@"animatestrokecolor"]; cgcontextmovetopoint(context, 0, 0); cgcontextaddlinetopoint(context, s...

c# - Find Control in collection - event ControlAvailable Disabled -

in lightswitch app need add small image control every row, when clicking on , should send detail screen. made silverlight control , added lightswitch app. partial void vidcontentitemressources_loaded(bool succeeded) { int index = 0; foreach (vidcontentitemressourcesitem cust in this.vidcontentitemressources) { this.findcontrolincollection("imagelinkicon", this.vidcontentitemressources.elementat(index)) .controlavailable += (s, e) => { mylinkimage = (e.control linkimage); mylinkimage.mouseleftbuttondown += mylinkimage_mouseleftbuttondown; }; index++; } } but if error event control available can't used on controls in collection .. so tried this linkimage neco = this.findcontrolincollection("imagelinkicon", this.vidcontentitemressources.elementat(index)) linkimage; neco.mouseleftbuttondown += mylinkimage_mouseleftbuttondown; but neco allways null because trying load control before it'...

html - Vertically center ul in div -

this code looks like. html <div id="container"> <ul> <li>...</li> <li>...</li> <li>...</li> </ul> </div> css #container { width: 584px; height: 50px; position: relative; overflow: hidden; } #container ul { position: absolute; margin: 0; padding: 0; width: 3504px; } #container ul li { width: 584px; float: left; margin: 0; padding: 0; overflow: hidden; } as title says, want center ul vertically inside div. cannot change above css rules because. i've been googling solutions , trying find way, seems collide rules have. any idea how this? would if instead of #container div used table 1 row , column? please use search function in future. full answer explained here ; code scenario: .container { display: table; height: 100%; position: absolute; overflow: hidden; width: 100%;} .helper { #position: absolute; /*a variation of ...

mysql - Correct the query to fetch data from three different tables -

i have created following query. select users.id, users.email, aucs.winner_id, aucs.beginner, accounts.user_id users, aucs, accounts users.id in ( aucs.winner_id ) , users.id not in ( accounts.user_id ) , aucs.beginner = '1' i want select users email addresses appears once in aucs table in column winner_id aucs.beginner should equal '1' , user id not available in accounts table. have written query placed above not working. this top of head, don't need accounts.user_id since wish records user_id not present in accounts. select users.id users_id, users.email, aucs.winner_id, aucs.beginner users left join aucs on aucs.winner_id = users.id left join accounts on accounts.user_id = users.id aucs.beginner = '1' , accounts.id null group users.id having count(aucs.winner_id) = 1

Implemeting amazon Simple nodification service in RUBY -

am trying implement amazon sns using ruby. want create topic,delete topic,subscribe topic,publish topic.these included in following code. #!/usr/bin/env ruby require 'rubygems' require 'aws-sdk' aws.config(:access_key_id => 'bt62w53q', :secret_access_key => '0edwg') @sns=aws::sns.new #d requirements alpha = @sns.topics.create('csc470test-alpha') @sns.topics.create('csc470test-beta') temp=gets @sns.topics.each |topic| puts topic.name if(topic.name=='csc470test-beta') topic.delete end end puts puts 'beta deleted.' puts @sns.topics.each |topic| puts topic.name end puts temp=gets puts #c requirements @sns.topics.each |topic| if(topic.name=='csc470test-alpha') subbed1=false subbed2=false subbed3=false topic.subscriptions.each |sub| if(sub.endpoint=='sn@aine.com') subbed1=true; end if(sub.endpoint=='pran@aine.com') subbed2=true;...

class - PHP: what is the difference between $object::method and $object->method? -

i write: $object->method but see: $object::method what's difference? -> used when referring member of object. :: scope resolution operator , used refer static member of class. example class test { public static function vehicle() { echo "bus"; } public function automobile() { echo "car"; } } you call function automobile() as $test = new test(); $test->automobile(); and call vehicle function test::vehicle();

php - Strpos is not working. I am using it to search number -

i trying build table (6x6) bomb or not in it. using following method randomise 10 bombs in 36 blocks. gives me bomb everytime. $i = 1; $numbers = null; $j = 0; while ($j < 10) { $sample = rand (1,36); if (strpos($numbers, $sample) === false) { $numbers = $numbers."".$sample.","; $j++; } } echo $numbers; while ($i < 37) { if (strpos($numbers, $i) !== false) { echo '<td><button value="safe" onclick="bombcheck(this.id)" id="'.$i.'" class="closed"></button></td>'; } else { echo '<td><button value="bomb" onclick="bombcheck(this.id)" id="'.$i.'" class="closed"></button></td>'; } if ($i%6 == 0) { ...

android - How update a fragment in viewpager tab? -

i have created fragmentactivity whith eclipse show actionbar tabs. in first tab show fragment list, , in next tab fragment text. want that, when selected 1 item of first tab, change second fragment list fragment. here code: tabactivity created eclipse , me: public class tabactivity extends fragmentactivity implements actionbar.tablistener { static final int num_tabs = mytab.values().length; public enum mytab{ categorias(0), productos(1); private final int index; mytab(int i) { this.index = i; } } sectionspageradapter msectionspageradapter; viewpager mviewpager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_pedido); // set action bar. final actionbar actionbar = getactionbar(); actionbar.setnavigationmode(actionbar.navigation_mode_tabs); msectionspageradapter = new sectionspageradapter( getsupportfragmentmanager()); // ...

ruby - To select a column from a table using values from another table -

i have tables columns below: employee: id number(10), name varchar2(10) department: id number(10), name varchar2(10), emp_ids varchar2(10) the values present in tables respectively are: employee: 1,abc,111 2,def,222 3,xyz,333 department: 111,development,'1,2' 222,testing,'2,3' my problem need select employee names using emp_ids column department table. example: select names employee id in (select emp_ids department name = 'development'); since emp_ids varchar2 datatype unable execute above command. note: using activerecord base connection connect oracle db ruby, including ruby in tags too. your data model not designed . could build query work be: more complex needed, eventually inefficient data grows in size, open inconsistency because can't define referential constraints properly, most vendor specific. i suggest use reliable data model. have n-n relationship, need 3 tables: employee (id number(10...

algorithm - ListMap: remove the m smallest element with the smallest values -

i have function take in input integer m, , remove m element of map smallest values. main problem o(nlogn) complexity. (n size of map) this solution: if (map.isempty()) return; if (map.size()<m){ //remove keys iterator<k> it=map.keys().iterator(); //collection of keys while (it.hasnext()) map.remove(it.next()); } else{ (int i=0; i<m; i++){ key=map.findkeymin() //complexity:o(n) map.remove(k); } you can in o(n) time. take @ http://en.wikipedia.org/wiki/selection_algorithm . essentially, find mth element , remove less or equal mth element.

macros - Include code from different function in PHP -

i have library c i'm adapting php. there no macros in php, need similar. let me give quick example: function check($test){ if($test == false) return; } and call such function inside few times: function checks(){ check(0==1); check(1==1); ... } and i'd want checks function stop after first test. please note not i'm trying do, example can understand i'm looking for. return statement in "check" should make function "checks" return. thanks in advance. how this.., <?php function check($test) { if($test == false) { //do something.. exit(); } } function checks() { check(1 == 1); echo "1 done..</br>"; check(2 == 2); echo "2 done..</br>"; check(0 == 0); echo "3 done..</br>"; check(1 == 2); echo "4 done..</br>"; check(1 == 0); ...

How to break a long with statement in python -

i have line of code in python this: with long_name_function(p) a, other_long_name_function(): and want break in multiple lines, because long, use backslashes, considered bad practice. use contextlib.nested, deprecated, there other alternative? this disregards premise of question recommend using backslashes in case: with really_really_long_name_function(p) f1, \ other_really_really_long_name_function() f2: pass as @jonclements said, can't use brackets or commas in case, there's no alternative backslashes way go , code looks pretty clean imo.