Posts

Showing posts from January, 2013

Resizing page on load with javascript -

<script> function resize(){ mywindow.resizeto(600, 500); mywindow.focus(); } </script> </script> <style> canvas{ border: 1px solid black; } </style> </head> <body onload="resize()"> why not working? when add alert function works, resizing, please :) browsers place lots of restrictions on resizeto ; here's firefox's list . fundamentally, if code didn't open window, or it's tab not window of own, can't resize it. can resize if opened window.open providing third argument (dimensions, features, etc.) , browser created new window (rather tab).

c# - Adding a Func to an ExpandObject as Dictionary -

so know how add properties expandoobject dictionary, i'm not sure how add func 's: for example: var foo = (idictionary<string, object>)new expandoobject(); foo.add("bar", "somevalue"); is fine. i'm not sure how i'd go on add foo.add("foofunc", (somestring) => { return somestring; }); as not object. appeciated, in advance func s objects may have explicit adding one: foo.add("foofunc", new func<string, string>(somestring => { //... return somestring; });

How to read a CSV file using shell script at granular level? -

my sample csv file is: test1,a=1,b=2 test2,c=3,d=4 i can fields test1 a=1 b=2 using while read f1 f2 f3 echo $f1 echo $f2 echo $f3 done < filename.csv but want read a=1 separately , save a in param1 , 1 in param2. want f2 & f3 1 one. could me in this? you can set ifs comma or equals, this: while ifs=",=" read b c d e echo $a echo $b echo $c echo $d echo $e done < file output test1 1 b 2 test2 c 3 d 4

c# - How to query database if it consists of many to many mapping? -

this question has answer here: many many query in entity framework 4 3 answers i using entity framework 6 , project consists of fluent api mappings entites. used entity framework generator generate classes , mappings. i have 3 tables in database -user -roles -userroles userroles consists of both userid , rolesid . entity framework generator doesnot generate userrole mapping , entity class. puts mapping in role class i name of role based on userid . how query it. thanks in advance. var userid = "bad5ea54-f32b-4450-ae50-883acdfda41d"; var query = user in context.aspnetusers user.id == userid userrole in aspnetuserroles userrole.user == user role in aspnetroles role == userrole.role select role.name;

uitableview - Remove UIActivityIndicator from cell content view when returning from detail view -

i have uitableview gets data internet when cell clicked displays uiactivity indicator , pushes detail view controller. when click uitableview cell clicked on has grey background , cell content no longer there. - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"tablecell"; tabelcell*cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; _activityindicatorcell = [[uiactivityindicatorview alloc]initwithactivityindicatorstyle:uiactivityindicatorviewstylegray]; // center of cell (vertically) int center = [cell frame].size.height / 2; int width = [cell frame].size.width / 1.1; // locate spinner in center of cell @ end of text [ _activityindicatorcell setframe:cgrectmake(width ,center - 9, 16, 16)]; [_activityindicatorcell sethidden:yes]; [[cell contentview] addsubview:_activityindicatorcell]; [ _activityindicatorcell startanimating]; [sel

shell - Reading full file from Standard Input and Supplying it to a command in ksh -

i trying read contents of file given standard input script. ideas how that? want is: somescript.ksh < textfile.txt inside ksh, using binary read data "textfile.txt" if file given on standard input. ideas how "pass" contents of given input file, if any, binary inside script? you haven't given enough information answer question, here few ideas. if have script want accept data on stdin , , script calls else expects data passed in filename on command line, can take stdin , dump temporary file. like: #!/bin/sh tmpfile=$(mktemp tmpxxxxxx) cat > $tmpfile /some/other/command $tmpfile rm -f $tmpfile (in practice, use trap clean temporary file on exit). if instead script calling command also expects input on stdin , don't have special. inside script, stdin of call connected stdin of calling script, , long haven't consumed input should set. e.g., given script this: #!/bin/sh sed s/hello/goodbye/ i can run: echo he

input - on webpage enter, display html browse file dialogue? -

i have following code giving manual browse file dialogue: input type="file" name="image_file" id="image_file" onchange="fileselecthandler()" is there way call (perhaps using javascript?) automatically on page enter user given browse file dialogue upon entering webpage? thanks! <input type="file" name="image_file" id="image_file" onchange="fileselecthandler()" style="visibility:hidden" /> and jquery code: <script> $(document).ready(function(){ $("input[type='file']").trigger('click'); }); </script> this requires permissions user allow pop ups security reasons... jquery trigger file input http://www.acunetix.com/websitesecurity/upload-forms-threat/

android - Use Image instead off text on actionbar 's label -

Image
this question has answer here: how can implement custom action bar custom buttons in android? 3 answers actionbar background image 5 answers i wondering if have image label on actionbar instead of using simple text. still want keep icon on bar, want enrich label image. . in order more specific attach image see want succeed. you can customized actionbar using android:actionbarstyle example: add in style xml <item name="android:actionbarstyle">@style/thin_ab_style</item> the thin_ab_style <style name="thin_ab_style" parent="@style/theme.sherlock"> <item name="android:height">60dp</item> <item name="android:background">@drawable/drop_down_shadow_actionbar</item&

java - KeyPressed not working in each program -

i transferred few programs computer @ school(a mac) @ school home pc. once on computer, noticed keys not work in each program. i've spent hours try figure out why keypressed isn't working. both computers used eclipse is because of different java version or because of different os? thank you! example of code: import java.awt.graphics; import java.awt.image; import java.awt.event.keyevent; import java.awt.event.keylistener; import java.awt.event.mouseevent; import java.awt.event.mouselistener; import java.awt.event.mousemotionlistener; import java.text.decimalformat; import java.util.random; import javax.swing.japplet; public class skeleton extends japplet implements runnable, mousemotionlistener, mouselistener, keylistener { random generator = new random(); boolean gamerunning = true, playagain = true; int width, height; int score = 0; image offscreenimage; int xx; int xy; image cart; image candy[]; int candyx[]; int candy

javascript - Why it won't pass the string to input field but it shows in HTML? -

when loads, can see key this your key: shf8tg382kds however, key won't appear in input field. why? , how can solve this? javascript part <script> window.onload = function(){ $(".chat#key").val($('#peer-id').text()).focus() } </script> html part <p>your key : <span id="peer-id"></span> </p> <input class="chat" id="key" name="messages[body]" placeholder="type key here!" type="text" /> update if change this, shows abc in input field. $(".chat#key").val('abc').focus()

c# - Bluetooth Low Energy connection parameters update - device or windows causing HRESULT: 0x80070005 (E_ACCESSDENIED))? -

i'm trying write gap service (0x180) characteristics , 0x2a04 whenever try writing 0x2a04 (connection parameters) or 0x0200 (device name), var devices = await windows.devices.enumeration.deviceinformation.findallasync(gattdeviceservice.getdeviceselectorfromshortid(0x1800)); var service = await gattdeviceservice.fromidasync(devices[0].id); var gapdata = service.getcharacteristics(new guid("00002a04-0000-1000-8000-00805f9b34fb"))[0]; var raw = await gapdata.readvalueasync(); byte[] conparas = new byte[raw.value.length]; datareader.frombuffer(raw.value).readbytes(conparas); //i can breakpoint , verify read works fine var status = await gapdata.writevalueasync(conparas.asbuffer()); and call writevalueasync(), program breaks on line , exception is an exception of type 'system.unauthorizedaccessexception' occurred in mscorlib.dll not handled in user code additional information: access denied. (exception hresult:

Counting list of words in c++ -

now i'm dealing uva problem 10420-list of conquests (link : http://uva.onlinejudge.org/index.php?option=com_onlinejudge&itemid=8&category=24&page=show_problem&problem=1361 ) . make point i'll make condition on problem simpler . need count how many words inputted. example must input of these. spain england england france and output how many times word inputted. must outputted alphabetically. england 2 france 1 spain 1 since don't know words come out how i'll count words condition in c++ ? in case there used standard container std::map<std::string, size_t> for example #include <iostream> #include <string> #include <map> int main() { std::map<std::string, size_t> m; std::string word; while ( std::cin >> word ) ++m[word]; ( const auto &p : m ) std::cout << p.first << '\t' << p.second << std::endl; } you should press either ctrl + z (in windows

visual studio - How to Add Google Code SVN using AnkhSVN to VS2010 Project? -

i had format pc , reinstall visual studio 2010. project saved in subversion repository in google code. how install project on pc continue working on project? open solution subversion : visual studio | file | open | subversion project...

reporting services - Keeping the structure of SSRS Table common -

Image
i have dataset returns top 5 rows table , display data in ssrs table. need maintain 5 rows table structure if number of rows returned dataset 0 or less 5. how can acheive this.? thanks a couple of possibilities. 1) add 5 footer rows table , set rowvisibility expression = countrows() > 0 through = countrows() > 4 . 2) hack query populates dataset such returns 5 rows. e.g. suppose current query is select top (5) name, create_date sys.objects order create_date you change with topfive (select top (5) name, create_date, row_number() on (order create_date) rn sys.objects order create_date) select tf.name, tf.create_date (values(1), (2), (3), (4), (5)) v(n) left join topfive tf on tf.rn = v.n order tf.rn

android - Get drawable of image button -

how can drawable of image button compare , if drawable , if b?. thank much. switch(getdrawableid(buttonrepeat)) { case r.drawable.a: mediaplayer.setlooping(true); break; case r.drawable.b: mediaplayer.setlooping(false); break; default: break; } use getdrawable() method in imagebutton , compare them using .getconstantstate().equals() sample code: imagebutton btn = (imagebutton) findviewbyid(r.id.myimagebtn); drawable drawable = btn.getdrawable(); if (drawable.getconstantstate().equals(getresources().getdrawable(r.drawable.mydrawable).getconstantstate())){ //do work here } references: http://developer.android.com/reference/android/widget/imagebutton.html comparing 2 drawables in android

sql - Rails changing query execution order -

i want perform query on first 10 records. so, rails console type: log.all.limit(10).where({"username"=>"peeyush"}).explain this gives: log load (0.8ms) select "logs".* "logs" "logs"."username" = 'peeyush' limit 10 clearly, limit 10 happens later. i try running: log.all.first(10).where({"username"=>"peeyush"}).explain but gives error: nomethoderror: undefined method `where' #<array:0x0000000539acd8> how should query performed? if understand correctly, want retrieve 1st 10 rows , filter 10 records username? filter in ruby all.first(10).find_all {|i| i.username == "peeyush" } filter on database all.where(:id => all.first(10).map {|x| x.id}, :username => "peeyush")

c# - Ensuring thread safety with ASP.Net cache - a tale of two strategies -

i have code not thread safe: public byte[] getimagebytearray(string filepath, string contenttype, rimgoptions options) { //our unique cache keys composed of both image's filepath , requested width var cachekey = filepath + options.width.tostring(); var image = httpcontext.current.cache[cachekey]; //if there nothing in cache, need generate image, insert cache, , return if (image == null) { rimggenerator generator = new rimggenerator(); byte[] bytes = generator.generateimage(filepath, contenttype, options); cacheitem(cachekey, bytes); return bytes; } //image exists in cache, serve up! else { return (byte[])image; } } my cacheitem() method checks see if max cache size has been reached, , if has, start removing cached items: //if cache exceeds max allotment, remove items until falls below max while ((int)cache[cache_size] > rimgconfig.settings.profile.cachesize * 1000 * 100

android - Setting table layout through Java dynamically -

i need screen have couple of text views defined in activity layout. below views want set table number of rows , columns depend upon user's input (dynamic). this code in oncreate of activity super.oncreate(savedinstancestate); setcontentview(r.layout.activity_home_page); tablelayout tablelayout = new tablelayout(getapplicationcontext()); tablerow tablerow; textview textview; (int = 0; < no_days; i++) { tablerow = new tablerow(getapplicationcontext()); (int j = 0; j < no_subjects; j++) { textview = new textview(getapplicationcontext()); textview.settext("hello"); textview.setpadding(20, 20, 20, 20); tablerow.addview(textview); } tablelayout.addview(tablerow); } setcontentview(tablelayout); but code taking whole screen , unable have text views have defined in activity layout. here's activity_home_page.xml <relativelayout xmlns:android=

css - Bootstrap icons are not displayed well -

im having mvc5 application , use following button display icon bootstrap it.the problem icon not displyed well(all icons tested having same issue..),i see rectangle instead of icon garbage can, im use in diffrent project , works well ,in contnet folder i've bootstrap.css & bootstrap.min.css.i think maybe miss file, things should verify exist in project ?or other suggestion.... @html.actionlink("delete", "delete", new { id = item.id }, new { @class = "glyphicon glyphicon-trash" }) did include font files?

bash - Change the text within a file so that the text is now corresponding to the subdirectory -

i need change text within each parameter file located in each subdirectory. there 361 subdirectories. excerpt parameter file: pdb foldername from: ~josh/documents/model_files/analysis/ foldername foldername needs correspond each subdirectory in parameter file located. how do 361 subdirectories using shell in terminal? (i not familiar batch , of stuff.) something that: find . -mindepth 2 -name "*" -exec sh -c 'sed -i "s,pbd foldername,pbd $(echo $(basename $(dirname {})))," {}' \;

swift - Grabbing values from a dictionary in a more elegant way -

i've been playing swift , getting quite tortured! consider: var mydict : dictionary <string, string> //do magic populate mydict values <magic being done> //now mydict has values. let's parse out values of mydict //this doesn't work let title : string = mydict["title"] //this let title : string? mydict["title"] this because isn't known whether key in dictionary. want say, though, "if title key in dictionary, give me value, else, give me empty string" i write: var mytitle : string if let title : string = mydict["title"] { mytitle = title } else { mytitle = "" } i believe works...but...it's quite lot of code each key of dictionary. have ideas in swift world on how supposed written? rd you write extension on optional: extension optional { /// unwrap value returning 'defaultvalue' if value nil func or(defaultvalue: t) -> t { switch(self) {

joomla - removal of admin-ui tabs in products for virtuemart -

Image
i want remove product status , product dimension tab products in virtuemart 2 any help? try this, check file 'product_edit.php' administrator\components\com_virtuemart\views\product\tmpl\product_edit.php and comment not required tabs $tabarray = array(); $tabarray['information'] = 'com_virtuemart_product_form_product_info_lbl'; $tabarray['description'] = 'com_virtuemart_product_form_description'; // $tabarray['status'] = 'com_virtuemart_product_form_product_status_lbl'; // $tabarray['dimensions'] = 'com_virtuemart_product_form_product_dim_weight_lbl'; $tabarray['images'] = 'com_virtuemart_product_form_product_images_lbl'; $tabarray['custom'] = 'com_virtuemart_product_form_product_custom_tab'; hope works..

Deactivate the scrollbars in handsontable -

in handsontable, possible show deactivated scrollbar? i want show scrollbar when number of rows more viewport , still wants deactivate visible scrollbar. there solution available this? i got how deactivate visible scrollbars in handsontable. there disable , enable methods defined in walkontable(3rd party used within handsontable). can used disable mouse clicks on scrollbar. also need capture mousewheel event in control capture mousewheel event , prevent propagate. $( '.htcore' ).on( 'mousewheel', function ( e ) { if (somecondition) { e.stoppropagation(); } } ); _handsontablecoreinstance.view.wt.wtscrollbars.vertical.dragdealer.enable();

Magento create shipment with tracking number programmatically -

from specific order want create shipment of order , allot tracking number programmatically. please . thanks the question knowledge sharing purpose . one can understand points ref_link // $order_id = order id $_order = mage::getmodel('sales/order')->load($order_id); if($_order->canship()) { $shipmentid = mage::getmodel('sales/order_shipment_api')->create($_order->getincrementid(), $itemsarray ,'your_comment' ,false,1); echo $shipmentid; // outputs shipment increment number $trackmodel = mage::getmodel('sales/order_shipment_api') ->addtrack($shipmentid,'your_shipping_carrier_code','your_shipping_carrier_title','carrier_tracking_number'); } $itemsarray = format explained here ref_link thats ! simple code snippet . hope helps .

java - Getting All Possibilities - Schoolwork -

what need take string array each element having exact length of 2, , find possible combinations of the elements, using each character within each string. mean string array {"ss", "ff"} returns "sf", "sf", "sf", "sf". have tried loop method counts iteration , chooses letter based on that, works arrays single element: public string [] generatepossibilities(string [] s) { if(s[0].length() != 2) throw new illegalargumentexception(); string [] r = new string [s.length * 2]; for(int = 0; < r.length; i++) { r[i] = getpossibility(i, s); } return r; } private string getpossibility(int iteration, string [] source) { int [] choose = new int [source.length]; for(int = 0; < choose.length; i++) { choose[i] = 0; } for(int = choose.length - 1; >= 0; i--) { if(iteration < 1) break; choose[i] = 1; iteration--;

mysql - Database: mark entity (record) as deleted for certain users -

given database table records multiple users in application can see, efficient way mark record deleted multiple users without deleting record (soft delete)? requirements: multiple users should able mark record deleted when user marks record deleted, user b, c, d... should still able see until mark deleted themselves an administrative user should able mark record deleted record no longer visible others. i've thought following example curious see other programmers do. table: entity +----------------+---------------+--------+ | id | data | active | | (int, primary) | (varchar) | (int) | +----------------+---------------+--------+ | 1 | foo | 1 | <-- record active (visible) | 2 | bar | 0 | <-- no user can see record +----------------+---------------+--------+ an administrative user set active flag 0 remove record scope of users. table: entity_deleted_user +----------------+--

Installing application developed in both VS 2010 and VS 2013 -

a mixed-mode (managed/unmanaged) application contains devxpress windows forms , wpf components installing when using vs2010 setup & deployment project. after windows updates pushed users, installation failed message: "error writing file: c:\users\auser\appdata\roaming\system.windows.interactivity.dll. verify have access directory." all users administrators of pc's. when reading installation log provided msiexec, errors related bitmap exceeding size of window. our code has no explicit dependency on interactivity.dll. the problem solved not using vs2013. seems need keep homogeneous development environment. have no explanation error message.

java - Does variables accessed within synchronized block must be declared volatile? -

in example this: ... public void foo() { ... synchronized (lock) { vara += some_value; } ... } ... the question is, vara must declared volatile in order prevent per-thread caching or enough access within synchronized blocks? thanks! no, don't need to. synchronized blocks imply memory barrier. from jsr-133 : but there more synchronization mutual exclusion. synchronization ensures memory writes thread before or during synchronized block made visible in predictable manner other threads synchronize on same monitor. after exit synchronized block, release monitor, has effect of flushing cache main memory, writes made thread can visible other threads. before can enter synchronized block, acquire monitor, has effect of invalidating local processor cache variables reloaded main memory. able see of writes made visible previous release.

entity framework - What's the proper way to model this relationship in ERD and EF? -

i'm designing brand new db model new system. goal have stored in sql , mapped objects entity framework. i'm heavily using table-per-hierarchy pattern in order support complex object hierarchy , have inforced "properly" db engine. i have following situation not sure how handle: i have set of entities called resources. each resource specific type , contains number of specific attributes. resource (abstract class, maps resources table) resource table has discriminator column , resourceid primary key classes such as: serverresource (concrete class, inherits resource, maps urlresources table that's 1-1 resource... overall there dozehn other resources-types (number growing) each type of resource has set of unique properties specific resource) i have number of entities called checks. each resource contains number of checks. resourceid foreign key in checks table. checks more interesting. there check types common or types of resources. , there che

php - create table from filename -

i attempting write script in php upload csv files , store them in mysql database. stumbling block appears when try pass filename variable table name created... <?php if ($_files["file_source"]["error"] > 0) { echo "error: " . $_files["file_source"]["error"] . "<br>"; } else { echo "upload: " . $_files["file_source"]["name"] . "<br>"; echo "type: " . $_files["file_source"]["type"] . "<br>"; echo "size: " . ($_files["file_source"]["size"] / 1024) . " kb<br>"; echo "stored in: " . $_files["file_source"]["tmp_name"] . "<br>"; } //check errors if($_files['file_source']['error'] > 0) { die('an error occurred when uploading.'); } else { echo "file uploaded <br />"; } //check fil

xslt - xml hierarchy/xsl processing with tei:note -

i have hope symptom of ignorance , not impossible problem, can't life of me make work. i putting footnotes using tei namespace xml, , relevant data packaged follows: <surface xml:id="eets.t.29"> <label>verse 29</label> <graphic url="/images/img_0479.jpg"/> <zone> <line> <orig><hi>n</hi>ow in <damage>th</damage>e name of oure lord ihesus</orig> </line> <line> <orig>of right hool herte <ex>&amp;</ex> in our<ex>e</ex> <note place="bottom" anchored="true" xml:id="explanatory">although “r” on painted panels of chapel consistently written otiose mark when concludes word, mark here rendered more heavily ,

Close iOS Keyboard by touching anywhere using Swift -

i have been looking on can't seem find it. know how dismiss keyboard using objective-c have no idea how using swift ? know? override func viewdidload() { super.viewdidload() //looks single or multiple taps. let tap: uitapgesturerecognizer = uitapgesturerecognizer(target: self, action: "dismisskeyboard") //uncomment line below if want tap not not interfere , cancel other interactions. //tap.cancelstouchesinview = false view.addgesturerecognizer(tap) } //calls function when tap recognized. func dismisskeyboard() { //causes view (or 1 of embedded text fields) resign first responder status. view.endediting(true) } ======================================================================== edit: here way task if going use functionality in multiple uiviewcontrollers: // put piece of code anywhere extension uiviewcontroller { func hidekeyboardwhentappedaround() { let tap: uitapgesturerecognizer = uitapgesturerec

ajax - jquery get fragment gets whole page -

anybody has experienced this, may wrong? use ended space followed id/hash of element on other page jquery loads whole page.... snippet here: var url = $(this).attr('href'); url = url+' #detail'; console.log('loading '+url); $.get( url, function(dt){datadetail = dt;} ); $('#result').append(datadetail); there element id="detail" on other page, both pages on same domain, yet loads whole page instead of fragment... may wrong? $.get doesn't work way, there no filter. load() has that, , still gets everything, filters before outputting. what want like var url = $(this).attr('href'); $.get( url, function(dt){ var datadetail = $('<div />', {html : dt}).find('#detail'); $('#result').append(datadetail); });

servlets - Adding response header after doFilter -

i have searched , seen couple of post problem, did not find answer how possible. what want add header after filter chain, public void dofilter(servletrequest request, servletresponse response, filterchain chain) throws ioexception, servletexception { httpservletresponse httpresp = (httpservletresponse) response; try { httpservletresponsewrapper bufferedresponse = new httpservletresponsewrapper (httpresp); chain.dofilter(request, bufferedresponse); } { // header added @ line not being added. bufferedresponse.setheader("add header: ", "header"); } } multiple posts talking possible using httpservletresponsewrapper not working me, can me on this. you can't add header (well, can won't have effect) after response has been committed since @ point http headers have been written client. you have 3 options. write header before call dofilter() make sure (large buffer, small response, no ca

xml - JAXB - proper annotation of java class -

i have xml document such : <parentclass> <firstclass> <row> <data1>...<data1> <data2>...<data2> </row> <row> <data1>...<data1> <data2>...<data2> </row> </firstclass> <secondclass> <row> <data1>...<data1> <data2>...<data2> </row> <row> <data1>...<data1> <data2>...<data2> </row> </secondclass> </parentclass> i have java classes below: @xmlrootelement(name = "parentclass") @xmlaccessortype(xmlaccesstype.field) public class parentjavaclass { @xmlelement(name="firstclass") private list<firstjavaclass> fc; public list<firstjavaclass> getfc() { return fc; } public

php - Autobahn TestSuite: Missing wampclient mode -

i'm trying test php implementation of wamp2 server autobahn|testsuite . according documentation , there should mode called "wampclient" available. however, when run wstest -m wampclient -w <server info> error says wampclient mode invalid. what need wampclient mode work? there way run tests against wamp2 server? i'm using following versions of software on osx 10.9.3: python 2.7.5 autobahn 0.8.9 autobahntestsuite 0.6.1 twisted version: 14.0.0

Joomla: comments for own component -

i have written own jommla component displaying particular information (for example car info: engine power, year , etc.). now want add comments component. implementing comments own hard , it's not safe. maybe had , experience integrating existing joomla component own component? update: maybe can copy-paste code of existing joomla comments component in own component? tried this? you should careful bespoke comments fields open spam attacks, unless filtered , moderated. if work needs, better building simple module embeds facebook or disqus comment widgets onto site, , assigning component pages. these seem quite @ stopping of spam.

html - Header div too big because of z-index? -

i used z-index layer images in header, , header size big. basically, height same if images layed out without being overlapped, ends being white space. result, body overlaps header. this page, may make sense @ mean, can post code if needed! http://kerryaltmantest.info/hometest.html eta - here's css: #header { width: 1100px; margin:0 auto; background: #ffffff;} #body {width: 950px; margin:0 auto; background: #ffffff;} #menu1 { width: 890px; margin:0 auto; background: #ffffff;} #content { width: 930px; margin:0 auto; background: #ffffff; border-left: 10px solid #2b297f; border-right: 10px solid #2b297f;} body { background: #d0d0d0;} .background { border: 0px ; position: relative; z-index: 1; left: -150px; top: -30px } .mainheader { border: 0px; position: relative; z-index: 2; top: -185px; left: 170px; } .phone { position: relative; z-index: 3; top: -298px; left: 675px} .email { position: relative; z-index: 4; top: -287px; left: 720px} and here's html: <div

wordpress - Category name with total number of product in that category in woocomerce -

can explain me how show category title number of product in category in category archive page category 1(10) the url http://www.example.com/product-category/category-1/ can me.............. have tried display total product of website. want product in category <h1><?php woocommerce_page_title(); global $woocommerce_loop; do_action( 'woocommerce_before_subcategory', $category ); echo apply_filters( 'woocommerce_subcategory_count_html', ' <mark class="count">(' . $category->count . ')</mark>', $category ); ?> </h1> to list categories along product count: $terms = get_terms( 'product_cat' ); foreach( $terms $term ) { echo 'product category: ' . $term->name . ' - count: ' . $term->count; } if have category id: $term = get_term( cat_id, 'product_cat' ); //replace category id he

git - What is the correct way to create a cocos2dx project using "create_project.py" and place it under version control, and access via Xcode? -

normally, when create project through xcode, receive option of having xcode place project under version control. with cocos2dx, 1 creates project using "create_project.py" tool, created number of folders each platform (ios, osx, android, wp8 etc). when open xcodeproj in "ios" folder, works fine in xcode. can't work after adding version control. here did: all these folders placed under root folder, name of project (lets call "stanly" stanly |->classes |-> proj.ios |-> proj.mac |-> proj.android ..... |->resources each of above "proj. here tried: i opened terminal under stanley, , ran following commands: git init git add . git commit -m "initial commit" it appears files in every subfolder has been added version control. in xcode, went "source control"-->"connect repository" , , pointed folder "init" repository. asked xcodeproj file open, , directory

python - xmlstarlet XML file validation against multiple xsd files -

i trying validate xmlfile against xsd, had problem validating xml file. because file contains 3 xsd files , namespaces there, don't know how pass values in xmlstarlet here have tried.. xmlstarlet val --err --xsd "h t t p://www.loc.gov/mets/ http://www.loc.gov/standards/mets/mets.xsd http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd http://www.loc.gov/standards/premis/v1 http://www.loc.gov/standards/premis/v1/premis-v1-1.xsd" issue-news-issn8159726_19170716.xml output come failed load http resource failed locate main schema resource @ '' is there ways validate without passing xsd command line directly can write xsd in xml file. i have many xml files need validate. tried desktop tool stylus studio thrown error properly, need on command line. please me.

swift - How to cast from UInt16 to NSNumber -

i have uint16 variable pass legacy function requires nsnumber. if try: var castasnsnumber : nsnumber = myuint16 i compiler error 'uint16' not convertible 'nsnumber' question how can recast nsnumber? var castasnsnumber = nsnumber(unsignedshort: myuint16)

email - Hide elements in HTML-mails on Apple Mail -

is there way hide elements (e.g. s or s) in html-mails when viewed apple mail-clients (apple mail on desktop os , ios)? maybe there easy way via css's -webkit properties? i think can use media query so, here code. , usin displaying none or block can hide elements. hope aware of media queries. <!-- iphone standard resolution 320x460 (landscape not needed because web apps start portrait on iphone) --> <link rel="apple-touch-startup-image" href="splash-320x460.jpg" media="(device-width: 320px)" /> <!-- iphone high resolution (retina) 640x920 pixels (landscape not needed because web apps start portrait on iphone) --> <link rel="apple-touch-startup-image" href="splash-640x920.jpg" media="(device-width: 320px) , (-webkit-device-pixel-ratio: 2)" /> <!-- ipad portrait 768x1004 --> <link rel="apple-touch-startup-image" href="splash-768x1004.jpg" media="(d

python - How to count and print the number of words in each line in a file? -

this question has answer here: python - count number of words in list strings 5 answers i want count total no of words in each line in file , print them.i tried with codecs.open('v.out','r',encoding='utf-8') f: line in f.readlines(): words = len(line.strip(' ')) print words the input file is: hello try knows may work the output is: 6 7 10 12 but need is: 1 2 2 3 is there function can use? have print first word of each line in file, , print middle word , last word of line separate files. you close. line: words = len(line.strip(' ')) should be: words = len(line.split(' ')) strip removes characters start , end of string, split breaks string list of strings.

java - Mapping a range of positive integers to range of inidices -

basically, need kind of mapping function should map integer (0 - n) index (0 - m). n = 10, m = 3, function should map: 1 -> 0 , 2 -> 1 , 3 -> 2 , 4 -> 3 , 5 -> 0 , 6 -> 1 , 7 -> 2 , 8 -> 3 , 9 -> 0 , 10 -> 1 . my brain pretty dead ended bull*&^% mapping :) public int getindexfornumber(int number, int maxindex) { int max = maxindex; while (maxindex > 0) { if (number % maxindex-- == 0) { return maxindex; } } return max; } can please direct me? why don't return remainder ? public int getindexfornumber(int number, int maxindex) { return (number - 1) % maxindex; } if negative numbers allowed public int getindexfornumber(int number, int maxindex) { int x = (number - 1) % maxindex; if (x < 0) x += maxindex; retrun x; }

javascript - Endless "loading" of the page due to JQuery script. How to solve it? -

my page stays in endless loading state due "emoji.js" script (google chrome testing). endless loading disables "emoji" smileys appearing , see them in text code. when hit "stop" cross button in chrome...they appear! it seems dumb issue can't figure out how solve it! others jquery scrips works fine, don't understand... my page: http://raphaelmartin.olympe.in/pc/music.html you have livereload , on specific port, @ end of page. it injecting code @ end of page load script file: view-source:raphaelmartin.olympe.in:35729/livereload.js?snipver=1 if try access file directly same loading forever problem. start removing until sort out :) if view network traffic of page, e.g. in chrome's f12 debugging tools, there red entry js file, has status of: (failed) net::err_connection_timed_out

python 2.7 - How to get all legends from a plot? -

i have plot 2 or more legends. how can "get" legends change (for example) color , linestyle in legend? handles, labels = ax.get_legend_handles_labels() gives me "first" legend, added plot plt.legend() . want others legends too, added plt.gca().add_artist(leg2) how can that? you can children axes , filter on legend type with: legends = [c c in ax.get_children() if isinstance(c, mpl.legend.legend)] but work @ all? if add more legends mention, see multiple legend children, pointing same object. edit: the axes keeps last legend added, if add previous .add_artist() , see multiple different legends: for example: fig, ax = plt.subplots() l1, = ax.plot(x,y, 'k', label='l1') leg1 = plt.legend([l1],['l1']) l2, = ax.plot(x,y, 'k', label='l2') leg2 = plt.legend([l2],['l2']) ax.add_artist(leg1) print(ax.get_children()) returns these objects: [<matplotlib.axis.xaxis @ 0xd0e6eb8>, <matp

php - woocommerce: removing link on get_categories and get_tags -

i have woocommerce outputting get_categories , get_tags in example below, need them text only. @ present, outputs text link category / tag. can link component removed? <?php echo $child_product['product']->get_categories(); ?> <?php echo $child_product['product']->get_tags(); ?> thank you. in case else looking solution this... <?php echo strip_tags ($child_product['product']->get_categories()); ?>

java - How to insert correctly data on MySQL db through JPA when tables are linked with OneToOne relationship -

Image
i have doubt , consequently don't know how proceed correctly. have 3 different tables in figure below. i'm using jpa. here code generated automatically netbeans shows entities. question should persist database? if put user , have automatically persisted phone numbers , client? i'm pretty confused here code usercredential user = new usercredential(); user.setusername(username); user.setpassword(utilbean.hashpassword(password)); user.setemail(email); client client = new client(); client.setusercredential(user); client.setname(name); client.setsurname(surname); client.setaddress(address); client.setcity(city); client.setzipcode(zipcode); client.setcountry(country); client.setfidelitypoints(0); clientphonenumbers phonenumber = new clientphonenumbers(); phonenumber.setusername(username); if(homenumber != null || !(homenumber.equals("")))