Posts

Showing posts from March, 2010

html - CSS Div Alignment and Positioning -

i'm trying create page similar this: http://bit.ly/1t8xgqp specifically, i'm talking row guy in kitchen. as envisage it, row consists of text container , image container encapsulated within row container. when window made smaller,the image appears move behind text column. when window made larger, text column sticks side of image column. image column sticks right side of screen @ times. i have been unable create this. here code: html <div id="row_container"> <div id="image_container"> <img src="images/1297x756_image.jpg" width="1297px" height="756px" border="0" /> </div> <div id="text_container"> text </div> </div> css #row_container { width: 100% height: 756px; background-color:black; position:relative; } #image_container{ width: 1297px; height: 756px; background-color:#03c; position:absolute; right: 0; } #text_c

javascript - HTML - Make table minimum height matches the current screen height -

i designing web page using table, layout looks following: <html> <head> </head> <body> <table> <tr><td></td></tr> <tr><td></td></tr> <tr><td></td></tr> </table> </body> </html> i need table minimum height match screen height, when content height less screen height should match screen height adding space in middle row. what simplest way achieve this? do not use <table> elements layout. in fact, css3 flexbox specification created layout requirements yours—the trick use display flex on parent element, , ensure row want fill minimum height allowed grow, using flex-grow: 1 . parent should have minimum height of 100vh . body { padding: 0; margin: 0; } div.content-wrapper { display: flex; flex-direction: column; min-height: 100vh; } div.row-2 { background-color

android - The menu does not appear in the map activity -

i trying create menu option none, normal, terrain, satellite, hybrid (google map) in map activity enable users select desired map type menu in not being shown in map activity. i have tried add super.oncreateoptionsmenu(menu); oncreateoptionsmenu before inflater without success. how can fix it? map activity: public class map extends fragmentactivity implements onmapreadycallback, connectioncallbacks, onconnectionfailedlistener{ @override public boolean oncreateoptionsmenu(menu menu) { menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.map_menu, menu); system.out.println("abc map oncreateoptionsmenu invoked."); return true; } @override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case r.id.maptypenone: map.setmaptype(googlemap.map_type_none); break; case r.id.maptypenormal: map.setmaptype(googlemap.map_type_nor

subprocess - How to write EOF to STDIN popen in python -

i have following command run through popen: p = subprocess.popen(["/usr/bin/whiptail", "--title", "\"progress\"", "--gauge", "\"\"", "6", "50", "0"], stdout=subprocess.pipe, stding=subprocess.pipe) to stop whiptail command running need send eof stdin. how send eof stdin in python ? or call p.terminate() what need close file used standard input script. so in case it's p.stdin.close() .

Ubuntu: deb control file has no build-depends, where do they come from then? -

i have deb file control file not contain build-depends line, still package has build-dependencies. come from? can't figure out. this deb file: http://download.opensuse.org/repositories/isv:/owncloud:/desktop/xubuntu_14.10/i386/owncloud-client_2.0.0-1_i386.deb can see control file has depends, no build-depends. but apt-rdepends --build-depends --follow=depends owncloud-client shows build-dependencies: owncloud-client build-depends: cmake build-depends: debhelper (>= 9) build-depends: kdelibs5-dev build-depends: libneon27-gnutls-dev build-depends: libocsync-dev (>= 0.91.4) build-depends: libqt4-dev , on. also sudo apt-get build-dep owncloud-client installs dependencies. the binary package doesn't have build dependencies (any longer), because built. source package has them; , when download source package, should find actual debian/control file in there does contain build-depends stanza. a typical contro

java - Tinify API with Android -

is possible use tinify compression api in android? i've implemented required stuff, app crashing time. here's code: file photo = new file(environment.getexternalstoragepublicdirectory(environment.directory_pictures), imagename()+".jpg"); try { log.d("tiny", photo.getabsolutepath()); source source = tinify.fromfile(photo.getabsolutepath()); } catch (ioexception e) { log.e("tiny", e.getmessage()); e.printstacktrace(); } a getting following error: fatal exception: main java.lang.noclassdeffounderror: java.nio.file.paths if it's not possible, there other apis image compression android? it's not possible as-is. note java.nio.file.paths added in java 7, android still supports java 6, some java 7 language features if using specific buildtoolsversion , minsdkversion . see things don't work section @ java7-on-android project page.

html - What is the correct way to use grids? -

i have started learn bootstrap. , first time have ever used grids layout. don't understand grids should put content. should this: <div class="row"> <div class="col-md-12"> <p> content </p> </div> </div> or should use parent element content this <div class="row"> <div class="col-md-12"> <div> or <footer> or <aside> or <content> etc <p> content </p> </div> or </footer> or </aside> or </content> etc </div> </div> if answer second. there ever reason okay put content directly column? or have misunderstod , should done in completly other way? what "best practice"? the best way this: <div class="container"> <div class="row"> <div class="col-md-12"> <div class="your-widget-name&

ios - UIButton background height does not wrap text (title) - Swift -

Image
the height of uibutton background (white in picture below) not wrap text (the title). try set inset (content), not work. doing wrong? try set background image resizable image: uiimage *image = [uiimage imagenamed:@"somebackgroundimage"]; image = [image resizableimagewithcapinsets:uiedgeinsetsmake(image.size.height / 2, image.size.width / 2, image.size.height / 2, image.size.width / 2) resizingmode:uiimageresizingmodestretch]; [self setbackgroundimage:image forstate:uicontrolstatenormal]; swift: var image = uiimage(named: "someimagename")!; image = image.resizableimagewithcapinsets(uiedgeinsetsmake(image.size.height / 2.0, image.size.width / 2.0, image.size.height / 2.0, image.size.width / 2.0), resizingmode: .stretch) button.setbackgroundimage(image, forstate: .normal)

scope - Python: Using .join to concatenate items in a list of strings within an enumerate for loop and receiving an unexpected output -

main problem: cant figure out why output file not writing verses 1:6 , 1:23. want figure out why , how fix it. i'm new python , don't quite understand if it's logic or misunderstanding of how things work in python that's leading me astray. using .join concatenate items in list of strings within enumerate loop , receiving unexpected output. specifically, using python parse .txt file. .txt file contains data on words in bible. want new output.txt read such new bible verses coincide new lines. problem is, python script wrote skipping on verse 6 , verse 23 on test data output. suspect has how i'm using .join in parallel loop , lack of understanding how works in python. however, understand committed logical error. here code. note debug statements, .join use in functions defined , how affect strings parsing in outer loop ("where think error @ wrong"). def concatenatenext_string_tf( index, lines_list): next_wl_index = index + 1 if next_wl_index &l

linux - bash scripting language print a list of numbers using a loop -

i want print in text file (numberlist.txt), using bash, numbers 000000 999999, 1 number in each line. example: 000000 000001 000002 ... 999999 this code: (when run nothing happens) #!/bin/bash cont=0 max_num=1000000 file_name=numberlist.txt #while counter cont lower max_num (-lt, “lower #than”) loop executed until [ $cont -lt $max_num ]; printf "%000002d\n" $cont > $file_name #cont= cont + 1 let cont+=1 done what doing wrong? instead of opening , closing file million times, once redirecting output of the loop instead of printf: #!/bin/bash cont=0 max_num=1000000 file_name=numberlist.txt while [ $cont -lt $max_num ]; printf "%06d\n" $cont #cont= cont + 1 let cont++ done > $file_name

angularjs - typescript: problems with angular.bind and map -

i have following code: function parsevaluefromcomplextype(complextype, item) { return item[complextype]; } in order bind value complextype, use angular.bind let parsevaluefromcomplextypewithvalue = angular.bind('', parsevaluefromcomplextype , config.complextype); val.values = val.values.map(parsevaluefromcomplextypewithvalue); now typescript complains: error ts2345: argument of type 'function' not assignable parameter of type '(value: any, index: number, array: any[]) => {}'. what error mean , how can rid of it? the map function accepts function 3 parameters, in structure: callbackfn: (value: t, index: number, array: t[]) => u the bind function of angular returns simple function type: bind(context: any, fn: function, ...args: any[]): function; the error say: can't put function callbackfn: (value: t, index: number, array: t[]) => u expected. another issue here trying use angu

java - static inheritance: is it possible? Are there better solutions? -

consider example (warning-very bad code): public abstract class { static float foo; public static void loadfoo(float incomingfoo) { foo = incomingfoo; } public static void displayfoo() { system.out.println("your foo is" +foo); } } class b extends class public class b extends { static float foo; //@override (overide not allowed static methods. dis problem...) public static void loadfoo(float incomingfoo){ foo = incomingfoo; } } class c pretty same b public class c extends { static float foo; //@override public static void loadfoo(float incomingfoo) { //i different static variable loaded class using method foo = incomingfoo; } } finally main class runs thing public class main { public static void main(string whatever[]){ b.loadfoo(5); c.loadfoo(8); b.displayfoo(); c.displayfoo(); } } so output of : your foo is0.0 foo

java - Error running my spring app -

below log. when added following maven dependency, spring application started show errors. now, not start. <dependency> <groupid>org.jvnet.staxex</groupid> <artifactid>stax-ex</artifactid> <version>1.7.7</version> </dependency> <dependency> <groupid>com.sun.xml.stream.buffer</groupid> <artifactid>streambuffer</artifactid> <version>1.4</version> </dependency> <dependency> <groupid>com.sun.xml.ws</groupid> <artifactid>policy</artifactid> <version>2.2.2</version> </dependency> <dependency> <groupid>javax.xml.bind</groupid> <artifactid>jaxb-api</artifactid> <version>2.2.3</version> </dependency> <dependency> <groupid>com.sun.xml.bind</groupid> <artifactid>jaxb-impl</artifactid> <version>2.0.1</ve

c# - Work while app is suspended in Windows Phone 8.1 -

i want know what, how, , limitations of work can done whilst app suspended. i'm not talking background tasks , since run whether app suspended or not, can while app in background, suspended. what noticed far if have backgroundtask completed event attached in mainapp, trigger fired whilst app suspended, meaning can in fact work in mainapp, app suspended. far have 2 ways of doing that, 1 using backgroundtask completed event, , other having timer forces happen. however, what, how , limitations of can suspended app not clear me. so, there way of working suspended app? , how cpu time have, if limited, work with? i have played around bit , found out messagewebsocket , if not disposed on app suspension, can still receive messages. you use open socket connection send messages, based on can execute code in background. a problem when app gets terminated os (when device not have enough memory), socket connection closed too. for more info on how implement sockets s

php - dd() reads values that var_dump() can't read -

in 1 of controllers call view variable $members : $members = member::orderby("created_at", "desc")->get(); then in view loop on member's groups: @foreach ($members $group) <?php $group = $group->group(); ?> <b>{{ $group->title }}</b> // fails @endforeach this throws trying property of non-object exception. if do @foreach ($member $group) <?php $group = $group->group(); ?> <?php dd($group); ?> // works <b>{{ $group->title }}</b> // fails @endforeach i can see attributes array populated values want. why can dd() read values can't read using {{ $var }} ? @foreach ($member $group) <?php $group = $group->group(); ?> <?php var_dump($group); ?> // fails <b>{{ $group->title }}</b> // fails @endforeach fails well. i think found error. reason cannot read $group->value , $group["value"] works. may g

arrays - how to find particular rows or columns in R with specific conditions -

for example, if have matrix or array following format m = matrix(c(1,1,0,0,0,1,0,1,0,0,0,0,1,1,0,1), # data elements nrow=4, # number of rows ncol=4, # number of columns byrow = true) # fill matrix rows how can find index of rows , columns have 0 inside? if have more complicated matrix in need find out in rows or columns numbers inside in specific interval? m = matrix(c(1,1,12,34,0,19,15,1,0,17,12,0,21,1,11,1), # data elements nrow=4, # number of rows ncol=4, # number of columns byrow = true) # fill matrix rows how should find column in numbers between (10 - 20)? thank 1 can on this. and, also, can not use or while loops deal it. you can that: which(apply(m, 1, sum) == 0 ) [1] 3 which(apply(m, 2, sum) == 0 ) [1] 3 where 1 search rows , 2 columns. results tell row , column has zeros. m can see row number 3 , column number 3 have zeros. or suggested akrun

c# - Internal Server Error Ajax ASP.NET MVC 4.5 -

i'm getting internal server error when try call action in controller, curiosity that's working in machine , in iis(i'm using iis 8 in machine), problem happens in iis 7 in environment. javascript code: @section script { <!--reference autogenerated signalr hub script. --> <script src="~/signalr/hubs"></script> <script type="text/javascript"> $(document).ready(function () { // declare proxy reference hub. var notifications = $.connection.executionhub; //debugger; // create function hub can call broadcast messages. notifications.client.updatemessages = function () { getallmessages(); }; // start connection. $.connection.hub.start().done(function () { getallmessages(); }).fail(function (e) { alert("fail hub start: " + e); });

c++ - How to properly convert a unix timestamp string to time_t in C++11? -

lets have text file , read timestamp there local variable "stime": std::string stime = "1440966379" // value has been read file. std::time_t ttime = ? // instance of std::time_t shall assigned above value. how convert string std::time assuming: we may use stl means (no boost). we use c++11 standard we don't know cpu architecture/os we're using (it should work cross plattform) we can not make (static) assumptions on how time_t internally defined. of course know in cases integral type, of 32 or 64 bit length, according cppreference.com actual typedef of time_t not specified. atoi, atol, atoll, strtoul ... etc. out of question @ least until have made sure other means did pick correct 1 out of possible candidates. this keep time in standards-approved format: need #include <chrono> std::string stime = "1440966379"; // value has been read file. std::chrono::system_clock::time_point newtime(std::chrono::seconds(std::sto

HTML/CSS float: left; is not working properly -

Image
i'm reading headfirst css/html , i'm having issue example. i'm attempting float body left of sidebar using float:left; it's not floating properly. i've been on html , css can't quite see what's wrong. this want like: and fiddle: https://jsfiddle.net/taubin/7lhz4wtd/ #main { background: #efe5d0 url(images/background.gif) top left; font-size: 105%; padding: 15px; margin: 0px 10px 10px 10px; width: 420px; float: left; } <div id="allcontent"> <div id="header"> </div> <div id="sidebar"> <p class="beanheading"> sidebar text </p> <p> sidebar text </p> </div> <div id="main"> <h1>quality coffee, quality caffeine</h1> <p> main text </p> </div> </div> any suggestions appreciated.

angularjs - ngResource GET with filter values -

i'm writing small test application can retrieve customers parse.com database. i have following form in html ... <body ng-app="myapp"> <div ng-controller="customercontroller"> <button ng-click="getcustomers()">get customers</button> <ul> <li ng-repeat="customer in customers">{{ customer.name }}</li> </ul> </div> </body> ... my angular app following: module var app = angular .module('myapp', ['ngresource']) .constant('myconfig', { 'api_url': 'https://api.parse.com/1/classes/', 'parse_application_id': 'xxxxxxxxxxxxx', 'parse_rest_api_key': 'xxxxxxxxxxxxx' }); factory app.factory('customersservice', function($resource, myconfig) { return $resource(myconfig.api_url + 'customer', {}, { query: {

laravel - Database Architecture: Multiple Type Relations -

i'm building laravel application has "listings". these listings can things boats, planes, , automobiles; each own specific fields. i have images table should relate each type of listing , users table needs map each type of listing. i'm trying determine best way map each listing type images , users . one way i've thought of doing having separate boats , planes , automobiles tables specific fields , having specific boat_images plane_images , automobile_images tables map each respective type. relating each type user bit tricky. i don't think 1 giant listing table fields i'd ever use through these 3 (which grow in size later) make sense --- , don't believe having general metadata field has json object full of specifications each listing work either when want have searchable database. i know of pivot tables , i'm trying grasp overall architecture here. appreciated. thanks! you have listings table, holding id , name . boats,

pyqt - How do i remove the error in QtString. Am using pyqt4 and Python 3.4.3 -

i'm new in python , started working pyqt design gui application. have succeeded generate python file following lines generating errors: _fromutf8 = qtcore.qstring.fromutf8 qstring seems no longer in qtcore. how write line? below part of code from pyqt4 import qtcore, qtgui import sys try: _fromutf8 = qtcore.qstring.fromutf8 except attributeerror: def _fromutf8(s): return s there no qstring now, qt use unicode directly instead replace it: _fromutf8 = lambda s: s

php - Upstream message - iOS GCM -

i'm trying implement google messaging in app , server using xamarin api . downstream messages (server app) working great, can't upstream working. at server side i'm using php xmpp library (jaxl), can auth @ gcm server , send messages devices. i've registered receive messages code: $xmppclient->add_cb("on__message", function($stanza){ echo "new message"; $data = json_decode(html_entity_decode($stanza->childrens[0] -> text), true); $messagetype = $data['message_type']; $messageid = $data['message_id']; //message id sent $gcmkey = $data['from']; //gcm key; ... }); at client, i'm using gcm api call sendmessage : public class sendclass : receiverdelegate { public void sendmessage(string message) { instanceid.sharedinstance.start(google.instanceid.config.defaultconfig); service.sharedinstance.sendmessage(new nsdictionary(

mysql - Overriding sql table structure -

table 1 create table `test`.`table_1` ( `id` integer unsigned not null auto_increment, `name` varchar(45), primary key (`id`) ) engine = innodb; table 2 create table `test`.`table_2` ( `id` integer unsigned not null auto_increment, `name` varchar(256) not null, `number` integer unsigned not null, primary key (`id`) ) engine = innodb; the result want get: table 1 , table 2 expected same, table 1 in coworker workspace , want change table 2 without losing data you can use alter table . should fine: alter table table_1 modify name varchar(256) not null; alter table table_1 add number integer unsigned not null; notes: not null s assume table empty (for number ) , name has no null values. otherwise, need default values.

fuelux - Fuel UX 3: is element id required for initialization through Javascript? -

i new fuel ux , trying make checkbox work. have following simple page: <!doctype html> <html lang="en" class="fuelux"> <head> <meta charset="utf-8"> <title>fuel ux 3</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css"> <link href="dist/css/fuelux.min.css" rel="stylesheet" type="text/css"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js"></script> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="//www.fuelcdn.com/fuelux/3.11.0/js/fuelux.min.js"></script> </head> <body> <div class="che

javascript - How to get the highest value in a json format dataset? -

i'm using highcharts, uses data series plot chart similar this: series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] i know can use json file feed dataset so, how can highest value? this how can highest value in data array. data = [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] var highest_value = math.max.apply(math, data); console.log(highest_value) //216.4

javascript - Separation of instances of Plugin from same Class -

i have created jquery plugin allows slider functionality created targeting specific class. in scenario if created 2 separate classes , 2 separate calls, separation works fine. problem : possible have 1 class multiple instances , separating them out? currently, if select image thumbnail or use prev , next function, changes on both instances. jsfiddle: http://jsfiddle.net/jagmitg/xcjeg06g/ (function ($) { $.fn.thumbnailslider = function (options) { var defaults = { thumbnailactivation: false, callback: function () {} }; var _se = $.extend(defaults, options); var $el = this, thumbnailhandler = $el.find('.product-gallery-super'), targetimg = $el.find('.main-image'), superzoomparam = thumbnailhandler.find('.active-thumbnail').data('image-index'), navigate = function (direction) { current = thumbnailhandl

reset - Quartz.NET fires a job multiple times -

i new quertz.net. inheriting windows service uses quartz.net schedule jobs. there job schedules other jobs (say resetjobs: ijobs). downloads job list database nightly @ 9pm, deletes scheduled jobs, schedules/starts jobs in downloaded job list. 1 of jobs in downloaded list resetjobs itself. when windows services starts, service downloads job list (including resetjobs) , schedules them. when resetjob fires @ cronjob time (0 0 21 1/1 * ? *), runs 10 times. service log shows 10 calls resetjob. service runs on single physical machine, not on clustered environment. [disallowconcurrentexecution] attribute on resetjob class doesn't help. resetjob still runs 10 times when fired. i don't know if root cause when resetjob fires, deletes scheduler , schedule again. if bad design, know how properly. thanks

object oriented - Console-based game in Java to demonstrate Solid principles and abstractions - Code Review Stack Exchange

i've written console-based demo while learning solid principles. along way, i've become exceedingly paranoid whether i'm writing code or not. here code have far: public class entity { //base template game entities... private string name; public entity(string name) { this.name = name; displayentityname(); } public string getname() { return name; } public void setname(string newname) { name = newname; } private void displayentityname() { system.out.println(name + " entity created..."); } public class player extends entity { private string[] inventory; //player have inventory. private int itemsininventory; private static final random rand = new random(); public player(string name) { super(name); inventory = new string[25]; //default inventory size. } public void attack(enemy enemy) //player can attack enemy types. { system.out.println(super.getname() + " attacked enemy..."); } public void findlegendarywea

java - Android Studio (Referencing Objects) -

a former vb6 programmer starting out android studio. i'm trying reference itemlist on layout. in vb i'd me.itemlist or thisform.itemlist but know myactivity.xml.itemlist won't it. how can reference itemlist control? sorry such noob question... first time around! code in activity_my.xml file: <listview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/itemlist" android:layout_centervertical="true" android:layout_alignright="@+id/textview" android:layout_alignend="@+id/textview" /> what need associate adapter. won't work: arrayadapter<string> myadapter=new arrayadapter<string>( this, android.r.layout.simple_list_item_1, mystringarray); my issue, namely, android.r.layout.simple_list_item_1 not way reference listview object in myactivity.xml file in android studio. keep getting "cannot resolve symb

xcode - New in Objective C. Simple bug at runtime. Thread 1: breakpoint 1.1 -

i learning objective c , have tried override superclass (nsobject) description method in bnritem class. though seems have done right, nslog not seem use overridden description method. instead see thread 1 breakpoint 1.1 in definition of description method , more precisely, defined descriptionstring. here console output. 2015-08-30 20:49:00.622 randomitems[46034:1002101] 0 2015-08-30 20:49:00.623 randomitems[46034:1002101] 1 2015-08-30 20:49:00.623 randomitems[46034:1002101] 2 2015-08-30 20:49:00.623 randomitems[46034:1002101] 3 (lldb) my main.m file: #import <foundation/foundation.h> #import "bnritem.h" int main(int argc, const char * argv[]) { @autoreleasepool { // create mutable array object, store address in items variable... nsmutablearray *items = [[nsmutablearray alloc] init]; //send message addobject: nsmutablearray pointed //by variable item, passing string each time [items addobject:@"one"]; [items addobject: @&q