Posts

Showing posts from May, 2011

objective c - Program received signal SIGKILL exception comes up when I quit in the multitasking bar (iPhone) -

when double tap home button , quit out of app multitasking bar , open app again, xcode reads: "thread 1: program received signal: sigkill" , freezes ipod. app has 1500+ lines can't put code up, sorry. doing wrong? your 1500+ lines of code innocent of crash. it happens when run app xcode , , terminate ipod , without stopping execution xcode . closing app multitasking bar doesn't stop execution in xcode( but, expect do ). so, when open again, xcode throws sigkill exception. and, doesn't harm app. no need worry it. and, ofcourse, don't know technical explanation behavior. not genious ;-)

oracle sql - finding entries with dates (start/end column) overlap -

so data this: id | start_date | end_date | uid | canceled ------------------------------------------------- 44 | 2015-10-20 22:30 | 2015-10-20 23:10 | 'one' | 52 | 2015-10-20 23:00 | 2015-10-20 23:30 | 'one' | 66 | 2015-10-21 13:00 | 2015-10-20 13:30 | 'two' | there more 100k of these entries. we can see start_date of second entry overlaps end_date of first entry. when dates overlap, entries lower id should marked true in 'canceled' column. i tried queries take long time i'm not sure if work. want cover overlaping cases seems slow down. i 1 responsible inserting/updating these entries using pl/sql update table set column = 'value' id = '44'; if sql%rowcount = 0 insert values(...) end if so maybe in step. tables updated/inserted using 1 big pl/sql created dynamically rows either updated or new ones inserted once again seems slow. and of sql 'dialects' oracle 1 cryptic had chanc...

doctrine2 - Doctrine tool breaking Symfony Dialog Helper in ZF2 -

i updated zf2 , started getting error in command line when using doctrine tool. while not effect work being done, annoying. i have searched relatively new using doctrine, not 100% sure need fix this: php deprecated: "symfony\component\console\helper\dialoghelper" deprecated since version 2.5 , removed in 3.0. use "symfony\component\console\helper\questionhelper" instead. in /var/www/cloud/vendor/symfony/console/helper/dialoghelper.php on line 34 php stack trace: i using zf2 version: 2.4 thanks on this! running composer update cleared problem me.

javascript - cannot impliment infinite scroll with my code -

i've read multiple examples on infinite scrolling, find hard implement code. here's code, data shown mysql database : <div class="container" align="center" style="margin-top:100px;margin-bottom:100px"><div class="row"> <?php $result = mysql_query("select * batai svarbumas=1 order id desc"); while ($row = mysql_fetch_array($result)) { extract($row); $link=$row["linkas"]; echo "<div class='col-md-4'>"; $sites_html = file_get_contents($link); $html = new domdocument(); @$html->loadhtml($sites_html); $meta_og_img = null; //get meta tags , loop through them. foreach($html->getelementsbytagname('meta') $meta) { //if property attribute of meta tag og:image if($meta->getattribute('property')=='og:image'){ ...

MS Access Queries Not Reflecting Newly Imported Data -

what common reasons query not reflecting newly imported data? i have database 3 tables first linked other two. have subdatasheet set in first table not reflecting newly imported data other 2 tables. queries should show of data tables not showing newly imported data. i have refreshed spreadsheets, saved, , close/reopen. suggestions?

php - Varnish ESI Request -- What Cookie Is Sent? -

new varnish, not new http. apologies if newbie/obvious territory, googling hasn't revealed answer. when varnish makes request esi include url what cookie (and other request information) sending along default is programmatically controllable via vcl configuration file. that -- it's understanding point of esi includes in varnish allow statefull information populated page pulled cache. statefull information (presumably) fetched application using session id, implemented via data sent in cookie. what's not clear me if varnish passes along the original request's cookie information the application's response cookie something else and irrespective of varnish passes along default, can controlled in varnish vcl file? (a php app, if matters) just did digging around , seems cookies passed esi requests. the esi requests processed varnish. allows process request headers , caching behavior again specific esi object. at http://blog.lavoie...

javascript - Bootstrap drowpdown not working in Meteor -

folks. i'm working on meteor application , have following section in navigation template meant render dynamically built dropdown menu. for reason, it's not dropping down, , have no idea why. i'm using twbs:boostrap package provide bootstrap. template section : <ul class="nav navbar-nav"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">browse <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> {{#each categories}} <li><a href="{{pathfor 'browse' slug=this.slug}}">{{name}}</a></li> {{/each}} </ul> </li> </ul> categories helper : template.registerhelper('categories', function() { return categ...

c++ - Passing in References vs. Pointers -

i getting error when pass in newtemp setemergencycontact() . error in regards to: temp->contact::setemergencycontact(newtemp); "error: no matching function call 'contact::setemergencycontact(*&contact)'" so question is: if have create object using pointer, how pass object function uses reference not pointer? contact generaterandomcontact(){ // name created // generaterandomname() , phone number created // generaterandomnumber(). using above random function, // 50% probability assign new contact emergencycontact // of 1 generated. otherwise leave null (default). // return contact. contact* temp = new contact; temp->contact::changename(generaterandomname()); temp->contact::changenumber(generaterandomnumber()); if(myrand(11) % 2 != 0){ contact* newtemp = new contact; temp->contact::setemergencycontact(newtemp); } return *temp; } emergency contact function: void co...

c# - Detect file played by sound card -

is there way detect file sound card playing program(full flush poker.exe) in c#? in advance, google brings copying audio whenever search this. have names of sound files. or if wav file changes in size when played maybe detect that. jeff

osx - Trouble with Scipy for Python 2.6 on Mac OS Lion -

i installed numpy , scipy on preinstalled python 2.6 on mac os lion using following instructions: numpy , scipy preinstalled python 2.6.7 on mac os lion numpy works fine; however, from scipy.sparse import csr_matrix , following errors. there need resolve issue? /library/python/2.6/site-packages/scipy/sparse/lil.py:21: runtimewarning: compiletime version 2.6 of module 'scipy.sparse._csparsetools' not match runtime version 2.7 . import _csparsetools /library/python/2.6/site-packages/scipy/sparse/csgraph/__init__.py:150: runtimewarning: compiletime version 2.6 of module 'scipy.sparse.csgraph._shortest_path' not match runtime version 2.7 ._shortest_path import shortest_path, floyd_warshall, dijkstra,\ /library/python/2.6/site-packages/scipy/sparse/csgraph/_validation.py:5: runtimewarning: compiletime version 2.6 of module 'scipy.sparse.csgraph._tools' not match runtime version 2.7 ._tools import csgraph_to_dense, csgraph_from_dense,\ /library/python/2.6...

php - Getting a crc32 mismatch while working with DynamoDB local -

after make call dynamodb (using php) following exception: crc32 mismatch. expected 2745614147, found 2745614147 from research i've done, appears have gzip can't figure out how fix it. any suggestions appreciated. also, shouldn't make difference, i'm developing dynamodblocal version @ moment. update : using new version 3 of sdk seems have few problems. after spending way many hours trying figure 1 out, downgraded latest version in 2.* branch , problem went away. i'm using latest version of local db came out couple of months ago (2015-04-27). please see this post in aws forum post solution issue.

python - AttributeError: 'Table' object has no attribute 'update_item' - DynamoDB v2 API -

i trying conditionally update item in dynamodb using following code: from boto.dynamodb2.table import table conn = get_layer1_ddb_connection() values_table = table(table_name, connection=conn) attrs = { 'values' : new_values, 'version' : existing_item['version'] + 1} condition_expression = 'version = :v' values_table.update_item(table_name, key=customer_id, attribute_updates=attrs, condition_expression=condition_expression, expression_attribute_values={':v': existing_item['version'],}, return_values='all_old',) where, layer1 connection created this: from boto.dynamodb2.layer1 import dynamodbconnection def get_layer1_ddb_connection(self): return dynamodbconnection(region=self.region, aws_access_key_id=self.creds[cred_access_key], aws_secret_access_key=self.creds[cred_secret_key]) self.region of type regioninfo , self.creds have worked other high level api calls. if i'm not mistaken, may hi...

c# - Print dialog of Excel.Interop freezes -

here's function use show print dialog (i write on c#). working nicely, when wrote it. problem - since day code keeps freezing app instead of printing. tried show() 30 missing params, doesn't make change. public bool print() { var f1 = _application.dialogs; var f2 = f1[excel.xlbuiltindialog.xldialogprint]; bool didntcancel = f2.show(); return didntcancel; } freezing happens in f2.show() call. app window keeps refreshing it's view, can't click on anything. tried go show() method assembler lines via ste-by-step debug, program doesn't go there, dies on moment of method call. appreciated :)

Access the store finder _findQuery in ember-cli -

i need override ds.store.findquery in ember cli. no problem in itself. the problem importing _findquery method 'finder' file -- in new app/store.js file this._findquery doesnt work https://github.com/emberjs/data/blob/master/packages/ember-data/lib/system/store.js in 'shimmed' component/ember-data prototype function ember$data$lib$system$store$finders$$_findquery(adapter, store, typeclass, query, recordarray has advice on required import statement. here failed attempts import ds 'ember-data'; import ember 'ember'; //import _findquery 'ember-data/lib/system/store/finders'; nope //import _findquery 'ember-data'; nope export default ds.store.extend({ findquery: function(typename, query) { var type = this.modelfor(typename); var array = this.recordarraymanager .createadapterpopulatedrecordarray(type, query); var adapter = this.adapterfor(type); ember.assert("you tried load query have no a...

angularjs - issue with running Angle - Bootstrap Admin app (angular-meteor version): TypeError: $browser.addPollFn is not a function angular-cookies.js:60 -

just purchased angle - bootstrap admin app wrapbootstrap tried run angular-meteor version of app the first issue meteor did not contents of default index.html, renamed file index.ng.html now error i'm getting in browser console is: typeerror: $browser.addpollfn not function angular-cookies.js:60 what can done fix this? not sure wrapbootstrap, error means using incompatible versions of angular , angular-cookies. external angular modules use (e.g. nganimate, ngcookies, ngresource, ngroute etc), should same version angular.

string - Unwrapping Json Swift (found nil) -

i trying decode json in xcode, not succed 1 of them. this : [ { "id": "1", "title": "bmw", "price": "500.00", "description": "330", "addeddate": "2015-05-18 00:00:00", "user_id": "1", "user_name": "canovas", "user_zipcode": "32767", "category_id": "1", "category_label": "vehicules", "subcategory_id": "2", "subcategory_label": "motos", "bdd": {} } "pictures": [ { "name": "http://cars.axlegeeks.com/sites/default/files/4315/media/images/2014_bmw_z4_sdrive28i_3790993.jpg" } ] } ] and want value of "name" "pictures" lines have error "unexpectedly found nil while unwrappin...

Using VHD as SD card with android-x86 on Hyper-v -

i have created , android-x86 4.4 vm running on hyper-v. attached additional hard disk on ide 1 controller virtual machine. open grub , add sdcard=/sda2/ don't see sd card mounted when vm starts up. have used df , mount command, still don't see new hard drive appear in output. ideas on troubleshooting this? take @ this , need create fat/msdos filesystem , mount using vold.

c# - MVVM Structure of UI specific logic -

what try solve dynamic menu , toolbar, have problems in defining project structure. i use prism 5, toolkit use regions, modularity, mvvm things. ioc use autofac. later purposes (plugins) , modules have option inserting menuitems in code. currently structre like: core.infrastructure core.model core.viewmodel ui.wpf ui.wpf.app (knows every other dll) i don´t want ui specific things in core.infrastructure, because maybe want change ui toolkit later und reuse project. but don´t want ui things in model, think best place viewmodel project. but later, don´t want 3rd party people have "access" viewmodel project, how solve particular problem? where define contracts ui logic? how structure whole project? regards, kevin

sockets - building simplified version of SSL with python -

i need little assignment. the goal of assignment build own simplified version of ssl. , use client/server sockets create tcp connection. part of create handshake phase , data phase. handshake: 1. client , server authenticate each other using certificates. 2.the client informs server data encryption , integrity protection scheme use (there no negotiation). pick favorite integrity protection , encryption algorithms , send other side string 3.the client , server send encrypted nonces(random numbers) each other. these nonces xored create master secret. so im stuck @ number 3 :( have no idea how code it.

php - How to Submit the form without reloading the page with codeigniter -

this form code using code ignitor <div id="tab_register_content"class="content-form hidden"> <?php echo form_open('renty/sign_up_user')?> <div> <?php echo form_error('register_email');?> <input id="register_email"class="input_placeholder email"type="text"value=""placeholder="email address"name="register_email"/> </div> <div> <?php echo form_error('password');?> <input id="register_name" class="password" type="password" value="" name="password" onfocusout="get_form_value_from_user()"/> </div> <div> <input id="register_remember_me_checkbox"type="checkbox"class="styled"name="remember_me"valu...

javascript - Sending complex object in ajax to MVC -

the value of list<order> returns null in controller action method while sending complex object. can identify issue? need pass array of objects indexes? javascript function oncustomerclick() { //var orders = []; //orders.push({ 'orderid': '1', 'orderby': 'saroj' }); var complexobject = { firstname: 'saroj', lastname: 'k', //orders : orders orders: [{ orderid: 1, orderby: 'saroj' }, { orderid: 2, orderby: 'kumar' }] }; var obj = { customer: complexobject }; var data2send = json.stringify(obj); $.ajax({ type: "post", url: 'home/testcustomer1', data: data2send, contenttype: "application/json; charset=utf-8", datatype: "json", success: function (arg) { //call successfull }, error: function (xhr) { //error occurred } }); }; m...

c# - Restrict Enum parameter to certain Enum types (at compile-time) -

i created static void method (enum myenum) , i'd feed enum types, or face mistake @ compile-time. i'm experimenting lot code (using gameplay mechanics shader variants), need change accepted types on whim, least possible maintenance of method class. basically, i'm struggling enums have done working classes (create shared base class use parameter type). first came mind attributes: can custom attribute affect compilation in way? i'd surprised if could. can mimic class inheritance in any way enum types, albeit create kind of category restrict method parameters? this impossible dream code: [attributeusage(attributetargets.enum)] public class shadervariant : system.attribute { } void method (t myenum) t : [shadervariant]enum { } my current options are: create aforementioned attribute tag selected enum declarations, , react during runtime (throw argumentexception if myenum.gettype() doesn't have attribute). approach silently allows me mess while codi...

c# - Change image.Source in ListView according to boolean -

i have listview 2 columns: "visibility" , "name" of system. value of column 1: button (btn_visibility) image (img_visibility). depending on boolean (true or false) object in code behind image should change, e.g. system.show_in_list = true; img_visibility.source = new bitmapimage(new uri(app.controller.paths.path_to_minus)); an image reachable under following relative path: app.controller.paths.path_to_"name of image", e.g. app.controller.paths.path_to_add; my xaml-code in systemmanagementwindow.xaml: <listview x:name="lv_systems" horizontalalignment="left" height="227" margin="313,5,0,0" verticalalignment="top" width="153" selectedindex="0" selectionchanged="listview_systems_selectionchanged"> <listview.view> <gridview> <gridviewcolumn header="{x:static p:resources.systemmanagementwindow_listview_col_1}...

r - Creating a hexplot -

Image
i trying create figure 1 depicted in third column of following image: link image in case of backup. basically have x , y positions of 200 particles , have msd data these 200 positions. i'd msd value should determine color map particles in coordinates (x,y) . msd should height, or z position corresponding each particle in (x,y) . i surprised @ incompetence, because have been trying solve problem last couple of days none of google searches gave me result. closest thing have found concept of "self-organizing map" in matlab , r, not know how use r , matlab's toolbox som utterly useful needs. i tried following code in matlab , attached plot result: clear all; close all; clc; x = (dlmread('xdata.dat'))'; % x 1x200 array y = (dlmread('ydata.dat'))'; % y 1x200 array msd = (dlmread('msd_field.txt'))'; % msd 1x200 array [x,y] = meshgrid(x,y); z = meshgrid(msd); z = [x; y; z]; surf(z) but think plot not useful @ all. wa...

ios - SpriteKit, SKSpriteNode scale with bouncing -

i need scale skspritenode(with physicsbody) bouncing. i don't want create 3(for example) skaction make it. does know scale method taking account restitution property of phisicsbody? thank in advance my variant below class openplayerscene : skscene { private var openfromframe: cgrect? private var logoimage: uiimage! let ballcategory: uint32 = 1 let wallcategory: uint32 = 2 convenience init(size: cgsize, openfromframe: cgrect, imageforopen:uiimage!) { self.init(size:size) self.backgroundcolor = skcolor.clearcolor() self.scalemode = .aspectfit self.physicsbody = skphysicsbody(edgeloopfromrect: self.frame) self.physicsbody?.categorybitmask = wallcategory self.openfromframe = openfromframe self.logoimage = imageforopen } override init(size: cgsize) { super.init(size: size) } required init?(coder adecoder: nscoder) { fatalerror("init(coder:) has not been implemented") } func initlogonode (logoimage: uiimage!) { let ...

java - Cannot interact with input (role=combobox) using Selenium WebDriver (Firefox) -

i'm studying selenium webdriver , testing skills on public site. issue cannot interact input element role='combobox' using selenium webdriver + java. need interact (select 2d option) first element of calculator ("Калькулятор"-"Тип расчета" - combobox near text). firefox shows code it: <div class="select2-search"> <label class="select2-offscreen" for="s2id_autogen2_search"></label> <input id="s2id_autogen2_search" class="select2-input" type="text" aria-autocomplete="list" aria-expanded="true" role="combobox" spellcheck="false" autocapitalize="off" autocorrect="off" autocomplete="off" aria-owns="select2-results-2" placeholder="" aria-activedescendant="select2-result-label-17"></input> when try click or sendkeys it writes element (both selects , selects2) not ...

python - Abstracting if statement and return by a function -

i have function this: def test(): x = "3" # in actual code, computed if x none: return none y = "3" if y none: return none z = "hello" if z none: return none is there way of making if statement go away , abstract function. i'm expecting this: def test(): x = "3" check_none(x) y = "3" check_none(y) z = "hello" check_none(z) ideally, check_none should alter control flow if parameter passed none. possible? note: working on python 2.7. you can code in thing this. def test(): #compute x, y, z if none in [x, y, z]: return none # proceed rest of code an better way use generator generate value x, y, z computation 1 value @ time. def compute_values(): yield compute_x() yield compute_y() yield compute_z() def test(): value in compute_values(): if value none: return none ...

c - Searching missing number - simple example -

a little task on searching algorithm , complextiy in c. want make sure im right. i have n natural numbers 1 n+1 ordered small big, , need find missing one. example: 1 2 3 5 6 7 8 9 10 11 - ans: 4 the fastest , simple answer 1 loop , check every number number comes after it. , complexity of o(n) in worst case. i thought maybe missing , can find using binary search. can think on more efficient algorithm in simple example? o(log(n)) or ? for comparison-based algorithm, can't beat lg(n) comparisons in worst case. because answer number between 1 , n , takes lg(n) bits of information represent such number. (and comparison gives single bit.) unless distribution of answers skewed, can't better lg(n) on average. now don't see how non-comparison-based method exploit fact sequence ordered, , better o(n) .

c++ - How to implement lock-free counter with std::atomic? -

in program multiple threads (checkers) requests webpages , if these pages contain data, threads (consumers) process data. need predefined count of consumers start processing (not all). try use std::atomic counter , fetch_add limit working consumers count. although counter stay in bounds, consumers identical counter values , real processing consumers count exceed limit. behavior depend on processing duration. simplified code contains sleep_for instead getting page , processing page functions. #include <iostream> #include <thread> #include <atomic> #include <chrono> class cconsumer { public: cconsumer::cconsumer( const size_t anumber, std::atomic<bool> &afire, std::atomic<size_t> &acounter) : mnumber(anumber), mfire(afire), mcounter(acounter){} void cconsumer::operator ()() { while (true) { while (!mfire.load()) std::this_thread::sleep_for(mmillisec...

c# - Obtain non-explicit field offset -

i have following class: [structlayout(layoutkind.sequential)] class class { public int field1; public byte field2; public short? field3; public bool field4; } how can byte offset of field4 starting start of class data (or object header)? illustrate: class cls = new class(); fixed(int* ptr1 = &cls.field1) //first field fixed(bool* ptr2 = &cls.field4) //requested field { console.writeline((byte*)ptr2-(byte*)ptr1); } the resulting offset is, in case, 5, because runtime moves field3 end of type (and pads it), because type generic. know there marshal.offsetof , returns unmanaged offset, not managed. how can retrieve offset fieldinfo instance? there .net method used that, or have write own, taking exceptions account (type size, padding, explicit offsets, etc.)? with tricks around typedreference.maketypedreference , possible obtain reference field, , start of object's data, subtract. method can found in sharputils .

How to specify callback function when filtering array with object elements in php? -

i have array items of object type, let my_object . the class defining my_object s has function want use filter array. how can specify function when calling array_filter ? class my_class{ private $exclude; public filter_function(){ return !$this->exclude; } } $array=array($my_object1, $my_object2, ....); $filtered=array_filter($array,'filter_function');//obviously not work my_object1 , my_object2 , ... instances of my_class , want $my_object1->filter_function() $my_object2->filter_function() ,..... be called filtering array. you need indicate object method in callback, using array syntax shown in php docs callbacks class my_class{ private $exclude; public filter_function(){ return !$this->exclude; } } $array = array($my_object1, $my_object2, ....); $classfilter = new my_class(); $filtered = array_filter($array,[$classfilter, 'filter_function']); in case, need create insta...

html - How to draw a marker in middle of path? -

Image
i have path (which line). able draw arrowhead of marker-end attribute of path . want make + sign in middle of path. think purpose, marker-mid should used. here code , output when use marker-end . here code , output when use marker-mid . marker-mid specifies marker type should placed points in path not first or last point. in other words, if have path consists of 4 points (thus 3 lines), marker-mid markers placed on middle 2 points. there no way automatically place markers in middle of line segment wish. need either place appropriate shape @ point yourself, or split line 2 half-lines. svg 2, still in development, have feature, can't yet.

(UNITY3d android game) When i don't touch the screen, my fps are lower than when i touch -

i've had problem long time smooth camera on mobile phone (platformer game), reported game works when fps don't drop below 60. notice fps fine when touch screen, when don't it, fps drop approximately 58, 59 , after camera don't follow player smoothly. testing create new scene fpscounter script , effects same. me it? think engine settings reasons, can't handle it. emphasized text //--------------------------------------------- // variables //--------------------------------------------- private float deltatime = 0.0f; //--------------------------------------------- // methods superclass //--------------------------------------------- void update() { deltatime += (time.deltatime - deltatime) * 0.1f; } void ongui() { guistyle style = new guistyle(); float x = screen.width - 110; float fps = 1.0f / deltatime; rect rect = new rect(x, 90, 100, 50); style.fontsize = 18; style.normal.textcolor = getcolor(fps); string text = string.format("{0:0,0.0000 fps}...

java - How can I count the number of a special character in a regular expression? -

well, i'm beginner in working regular expressions , wanna design program language contains of , b ( mean want accept words using , b.) starts counting number of a, , b in expression enter. don't know methods useful in case... you cannot count occurances of character x in string regular expressions. can validate fixed number n of x present. make familiar regular , context free , context sensitive grammars. you should use java.util.scanner , tokenize input , count it.

calendarview - how to change the particular date text color in calendar view using android? -

i using calendar view in android. trying change particular text colour in calendar view not able find method setselecteddatetextcolor(int color) . please tell me how achieve this. it's perfect work me. try it. private void initializecalendar() { // todo auto-generated method stub calendarview cvcalendar = null; cvcalendar.setshowweeknumber(false); cvcalendar.setfirstdayofweek(1); cvcalendar.setselectedweekbackgroundcolor(getresources().getcolor( r.color.darkgray)); cvcalendar.setunfocusedmonthdatecolor(getresources().getcolor( r.color.darkgray)); cvcalendar.setweekseparatorlinecolor(getresources().getcolor( r.color.white)); cvcalendar.setselecteddateverticalbar(r.color.white); cvcalendar.setselected(false); cvcalendar.setondatechangelistener(new ondatechangelistener() { @override public void onselecteddaychange(calendarview view, int year, int month, int d...

How to change the background color of a html page using forms and php? -

after inputting color of choice page should change background color. should done using html forms. <body bgcolor="<?php $_get["color"]; ?>"> <form method="get" name="color"> background color:<br> <input type="text" name="color"> <input type="submit" value="submit"> </form> </body> you should use css instead of html attributes decorate html rendering. should avoid use inline styling represents better organization since it's separating languages (= separating css html). so answer question, can : <?php if (!isset($_get["color"]) || $_get["color"] === '') { $_get["color"] = 'pink'; } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>my website<...

How to remove a CSS style completely and not replacing it? -

i have style given in following way: td,th{padding:0} now want remove style dynamically , not override value because need inline/default value set browser. having idea how this, feel free answer. in css 3, might want use th,td { padding: unset; } or th,td { padding: initial; } http://www.sitepoint.com/css3-inheritance-tips-tricks/ http://www.w3.org/tr/css-cascade-3/#inherit-initial

HTML5 Canvas efficiency -

does html5 canvas waste memory , cpu render pixels off window? suppose have following 3 images want render onto 100 100 canvas: +---------+-------+--------+-------+-------+--------------------+ | image | width | height | x | y | remark | +---------+-------+--------+-------+-------+--------------------+ | 1.svg | 50 | 80 | 10 | 10 | fits in | +---------+-------+--------+-------+-------+--------------------+ | 2.svg | 200 | 180 | -30 | 10 | partially fits | +---------+-------+--------+-------+-------+--------------------+ | 3.svg | 300 | 400 | 130 | 200 | totally off canvas | +---------+-------+--------+-------+-------+--------------------+ if draw 3 images onto canvas, native code intelligent enough not waste resources drawing parts of 2.svg , whole of 3.svg , or our responsibility clip/skip these in tile engine?

if statement - unable to predict result to an if else condition in python -

what following code produce output? temp = '32' if temp > 85: print "hot" elif temp > 62: print "comfortable" else: print "cold" you're comparing strings integers. python strongly-typed language: not automatically convert types reason. >>> 1e320 > '0' false you should force type conversion if know values bot of same type. >>> 1e320 > int('0') true however, if defining value there, please define in way makes comparison valid. temp = 32 # not '32' if temp > 85: print "hot" elif temp > 62: print "comfortable" else: print "cold"

java - Prevent GSON from serializing JSON string -

i'm new gson, , have newby question have not found answer to, please bear me. stackoverflow , google not friend :( i have java class "user", , 1 of properties, "externalprofile" java string containing serialized json. when gson serializes user object, treat externalprofile primitive , escaping json adding slashes etc. want gson leave string alone, using "as is", because valid , usable json. to distinguish json string, created simple class called jsonstring, , i've tried using reader/writers, registertypeadapter, nothing works. can me out? public class user { private jsonstring externalprofile; public void setexternalprofile(jsonstring externalprofile) { this.externalprofile = externalprofile; } } public final class jsonstring { private string simplestring; public jsonstring(string simplestring) { this.simplestring = simplestring; } } public customjsonbuilder(object object) { gsonbuilder builder = new gsonbuilder(); ...

c++ - SDL_Keycodes are too big for storage -

while searching methods of detecting multiple keys @ once in sdl 2, came across piece of code sdl 1.x: //author: rob loach // global key buffer bool keys[256]; while(sdl_pollevent(&mainevent)) { if(mainevent.type == sdl_keydown) { keys[mainevent.key.keysym.sym] = true; } else if(mainevent.type == sdl_keyup) { keys[mainevent.key.keysym.sym] = false; } } i tried implementing in sdl2 , std::array<bool, 256> , had segmentation fault: 11 button. that's when looked @ this: https://wiki.libsdl.org/sdlkeycodelookup . most of 'special' keys including arrow, function, symbols, , on have decimal representations in billions. even simple code printf("%d\n", e.key.keysym.sym); on, button gives: 1073741906 segmentation fault: 11 i on mac, if makes difference error codes. so, solutions there in sdl 2? first of all, bool s don't default in c++ , need initialize them. fact appear true they're byte i...

How to properly unit-test a linked list (using Python)? -

i'm new tdd. i've created main functions (insert, search, remove etc.). insert_beginning() function: def insert_beginning(self, node): ''' inserts node beginning of list. ''' node.set_next(self.head) self.head = node my question is, how unit-test function? way can thing of is: class listfunctionstest(unittest.testcase): def setup(self): self.list1 = linkedlist() self.node1 = node(1) def test_insert_beginning(self): self.list1.insert_beginning(self.node1) self.assertequal(self.list1.__str__(), "1") but test_insert_beginning() function dependent on my __str__() # string representation of linked list function. have feeling way i'm testing not correct (because moment decide change way linked list represented, i'd end having rewrite test cases). there way test insert_beginning() function without depending on function created / customized? edit: wondering, curren...

par - Unable to convert perl script to exe using Perl2Exe -

i explored perl2exe, par, par::packer convert perl script exe. unable convert via either of options below, kindly can let know needs done. 1) downloaded perl2exe (p2x-11.00-win , p2x-16.00-win) convert perl script, getting below error. using windows 7, 32 bit. "invalid platform win64-5.20.2" - 5.20.2 activeperl version using. 2) unable install par , par::packer command prompt, throws error while unpacking .tgz files, saying - can't extract files c:\users........

php - Scraping using DomXPath -

using php domxpath scrape websites. currently using tutorial traverse xpaths. i scraping site , getting character names , steam id (the mess of xpath below gets 1 steam id). my question - there multiple steam ids , character names. xpath painstakingly created gets one. how should scrape all of steam ids instead of 1 of them? $xpath = new domxpath($this->ourteamhtml); /* set http response header plain text debugging output */ header("content-type: text/plain"); $steamname = $xpath->query('//*[@id="wrapper"]/section/div/div[1]/div[2]/div[2]/div[1]/div/div/div[1]/div/div[1]/h5/b'); /* traverse domnodelist object output each domnode's nodevalue */ foreach ($steamname $node) { echo "steam name: " . $node->nodevalue . "\n"; } your xpath verbose, having full path , element indexes not intuitive read , tends break due slight changes in page source. try using following simpler xpath : //*[@id="wra...

python - Cleaner way to move renamed files when walking over directory -

i created script walk on directory , move music files music folder while renaming files using regular expression library check if files numbered (as find annoyance). script seems working fine, haven't encountered errors, wondering if there cleaner way this seems bit convoluted , unpythonic. (striving write cleaner code). cleaner i'm not asking rewrite entire code block(s), rather check_names function , it's implementation when moving files. if there other errors helpful pointed out below reason. if terrible code apologize python "sins" may have committed have used os , regular expression modules few times before. since learning how use these , have little exposure @ point, explanation of why go long way aid in understanding. os.path.join(....) attempt @ making cross-platform , not having hardcode paths. reason seems bit convuluted due runtime takes approximately 1-2 min following on 6-7 folders: extract compressed .zip archives original directory walk on...

wcf - too long string error received Error 414 -

i facing problem in wcf restful web service . i have image , sending database android application 1st converting image base64 string 10,000 characters through application. in wcf reconvert base64 string in real image , send image db. issue when sending base64 long character string wcf. wcf reject , long string error received error 414. i used post , both methods , increase buffer size same error time received. same method when apply in .asmx soap web service each image insert successfully you need check service buffer setting in binding configuration.if working default 1 update it.

html - how to format a button on each side of an H3 tag -

plan [button] [h3] [button] html <span class="glyphicon glyphicon-chevron-left"></span> <h3>title may or may not long enough break new line</h3> <span class="glyphicon glyphicon-chevron-right"></span> should simple right? keep ending either [button] [h3] [button] or [button] [h3] [button] example: http://jsfiddle.net/s9x2kxyz/ there more ways it, above fiddle shows 1 way that's simple: html: <span class="glyphicon glyphicon-chevron-left"></span> <h3>title may or may not long enough break new line</h3> <span class="glyphicon glyphicon-chevron-right"></span> css: h3, span {display:block;float:left;text-align:center;} h3 {width:80%;margin-top:10px;} span {width:10%;margin-top:15px;} the vertical alignment part can tricky when don't know how many lines there may on h3, that's nature of beast in case...the margin-top in example s...

Chrome App FileReader -

i'm trying make use of file system api in chrome app. i've tried sample code can find , can't simple text file read. i'm logging every step, , seems happen (or not happen) stops first time reference file reader object. creates fine, because can log .readystate, after can't seem set onload()event or execute .readastext(). here's i'm calling button: function clickbutton(){ chrome.filesystem.chooseentry({type: 'openfile', acceptsmultiple: false}, function(fileentry){ if(chrome.runtime.lasterror) {console.warn("warning: " + chrome.runtime.lasterror.message);} else{ console.log(fileentry); var thing = new filereader(); console.log(thing.readystate); thing.onloadstart(function(){ console.log("started loading " & fileentry); }); console.log("added onloadstart"); console.log(thing.readystate); console.log(thing); thing.readastext(fileentry);...

How do I give read/write access to all nodes with Firebase rules? -

default setting gives full access: { "rules": { ".read": true, ".write": true } } for sake of testing understanding of rule-writing firebase guide , documentation, i'm (now retreating to) trying achieve same results writing rules 4 parent nodes. if makes difference, first 2 nodes have values, no children. **sidequest: still called nodes? the rules below cause same behavior when rules above changed false read , write. { "rules": { "mynode1": { ".read" : true, ".write" : true }, "mynode2" : { ".read" : true, ".write" : true }, "mynode3" : { ".read" : true, ".write" : true }, "mynode4" : { ".read" : true, ".write" : true } } } what wrong rules? update/context: i have authdatacallback stops running here (withi...

swift - Appending Tuples to an Array of Tuples? -

i'm trying make array of tuples store data of to-do-list app can't figure out how append tuples array. here code: first, array declared globally: var eventlist : [(name: string, date: string)] = [] here's code tried use, complier error saying "missing argument parameter 'date' in call". (this line of code inside buttonpressed action) eventlist.append((name: titlefield.text, date: convertdate(eventdate.date))) why causing compiler error , how can fix it? make typealias tuple , use it. typealias mytuple = (name: string, date: string) var eventlist : [mytuple] = [] var v: mytuple = (name: "a", date: "1") eventlist.append(v) eventlist.append((name: "b", date:"2")) println(eventlist)

homebrew - curl error with brew install php56 --with-cgi -

after running following commands, curl error on osx yosemite. can use brew in others not php56. can download https://www.php.net/get/php-5.6.10.tar.bz2/from/this/mirror not through curl. how can fix problem? in advance. brew tap homebrew/dupes brew tap homebrew/versions brew tap homebrew/homebrew-php brew options php56 brew install --with-cgi php56 ==> installing php56 homebrew/homebrew-php ==> downloading https://www.php.net/get/php-5.6.10.tar.bz2/from/this/mirror curl: (60) ssl certificate problem: invalid certificate chain more details here: http://curl.haxx.se/docs/sslcerts.html curl performs ssl certificate verification default, using "bundle" of certificate authority (ca) public keys (ca certs). if default bundle file isn't adequate, can specify alternate file using --cacert option. if https server uses certificate signed ca represented in bundle, certificate verification failed due problem certificate (it might expired, or name might not match...

compilation - How to make my cheque generator output exactly what it is instead of "Zero" in C -

my cheque generator program has worked flawlessly input give make output numerals in words. example if input "1234.56" out put "one thousand 2 hundred thirty 4 dollars , ... 56 cents". whenever want output "1000" output "one thousand 0 dollars , ... 0 cents". not 1000 0 dollars, cents fine, wish rid of "zero" need in there moments such if type in "0.01" output "zero dollars , 1 cent". the code follows: #include <stdio.h> void printnum(int); void printnum2(int); int main() { int = 0; int b = 0; int c = 0; int d = 0; int num = 0; int printcents; //to convert float "cents" integer. float inclusive; float cents; printf("welcome ipc144 cheque generator!!\n"); printf("pay order of... amahmood29 (018359133)\n"); printf("enter monetary value $0.01 $9999.99 inclusive: "); scanf("%f", &inclusive); if(inclusive < 0.00 || inclusive >= 10000.00) { ...