Posts

Showing posts from April, 2011

android - Failed to resolve: com.mcxiaoke.volley:library:1.0.19 -

i wanted integrate volly library, got same error error:(15, 13) failed resolve: com.mcxiaoke.volley:library:1.0.19 here build.gradle : http://pastebin.com/ff3n8vfe someone faced issue before? see many projects using without problems :( thanks helping i met problems, you, maybe should add this! allprojects { repositories { jcenter() } }

Change MenuItem dynamically in Android? -

i have set of menuitems in actionbar , webview used display webpage part of .net project, when user login webapplication, there possibility change menuitem dynamically? i'm not sending request server. there way capture latest url has been loaded webview , compare other parameter? you have override onprepareoptionmenu inorder update menu item. see below piece of code: @override public boolean onprepareoptionsmenu(menu menu) { menuitem menuitem = (menuitem) menu.finditem(r.id.---); //your code........... }

Passing list of objects from Grails controller to iReport generated Jasper report -

can please me started on generating reports grails? let's have book domain class , want pass list of books ireport generated jasper report. need in order generate report lists book titles , authors? this: class book{ string author string title } def listbooks = { def books = book.list() chain(controller:'jasper',action:'index',model:[data:books],params:params) } what need on grails side , on ireport side? little resources jasper noobs.

c - Can't Understand Glib Error -

i making use of glib 2.0 framework. after time, c program outputs error: glib-critical **: g_hash_table_foreach_remove_or_steal: assertion `version == hash_table->version' failed can tell me means in general? google hasnt helped much. thank you a google search text provided produced: this indicates did g_hash_table_remove() (or g_hash_table_insert(), g_hash_table_replace() or similar) while iterating on same hash table. didn't spot happen. taken here . hopefully, have enough information find error in code.

ruby - Displaying Current User in view through a polymorphic association -

i attempting display current users name once logged in. therefore @ top of page "logged in patrick". have polymorphic association set whereby every user signs either player or coach. the polymorphic association under label or :tennis_player both coach , player play tennis. the code view below. <div class="container"> <header> <div class="logo"> <%= link_to(image_tag 'tennis_ball.png', :width => 100, :height => 100) %> </div> <div class="slogan"> <h3>setfortennis</h3> </div> <div id="user_nav"> <% if current_user? %> logged in <%= @current_user %> <%= link_to "log out", log_out_path %> <% else %> <%= link_to "sign up", sign_up_path %> or <%= link_to "log in", log_in_path %> <% end %> </div&g

Rally Tool - API -

we have used qc tool till now, start using rally tool. as qc system of testing results, used extract data using macro designed based on api's. now time has come work on rally , design such tool. me understand how connect rally , extract data in excel format using programming language(especially vb script). first interest find out whether rally has api's qc used have, connecting , extracting data it? #!/usr/bin/env ruby # ruby script print out names of workspaces user has access to. # more api info: https://github.com/rallytools/rallyresttoolkitforruby # invoke 3 arguments: 'https://rally1.rallydev.com' 'username@domain.com' 'mypassword' require 'rally_api' @rally = rallyapi::rallyrestjson.new( :base_url => argv[0].end_with?('/slm') ? "#{argv[0]}" : "#{argv[0]}/slm", :username => "#{argv[1]}", :password => "#{argv[2]}", :version

java - How to inject a path into a type="file" field using JavaScript -

i'm having problem sending path file type="file" field (file upload scenario) handles bit weird. i'm using webdriver java , not wish use 3rd party tools such autoit. please note trying element.sendkeys not work, field default opens os browse-to-file type window cannot handled webdriver. you can see below how looks like: <input type="file" size="40" name="filename"> this not expand further , represents field + browse button! the solution found out how work above scenario (without sendkeys , autoit) javascript injection, have no idea how that. thanks, vivian thanks comments guys! the solution, sendkeys indeed, after generating retarded xpath in human history firepath. be careful, previous attempts didn't work xpath used before "//input..." , though valid, sending keys browse button, xpath-wise same element field (what sorcery this?). so yeah, has problems file upload forms via webdriver

How get ImageMagick filters dir -

some versions ago there command filters (and coders ) imagemagick dirs: magickcore-config --filter-path but (i use 6.8.0 version) seems there no such command anymore. command give error. seems there no such option --filter-path . so how should filters dir? magickcore-config script. performs pkg-config calls. content of /opt/local/lib/pkgconfig/imagemagick.pc (there no link filters dir exists): prefix=/opt/local exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include/imagemagick name: imagemagick description: imagemagick - convert, edit, , compose images version: 6.8.0 libs: -l${libdir} -lmagickcore cflags: -i${includedir} i found filters dir manually on system @ /opt/local/lib/imagemagick-6.8.0/modules-q16/filters . need automated way. the error overpassed next way: according http://www.imagemagick.org/script/resources.php there user-related dir filters , coders: $home/.magick . use in scripts. you need set following environment va

android - Hockeyapp distribution with daily build -

i have developed android application , has been deployed on server side, , apk file generated , want automate steps hockeyapp distribution. when .apk has been built, want send testers. my question how hockeyapp automated daily build? there guideline or tutorial? quick googling 'gradle hockeyapp plugin' brought this . option (imho preferred one) have build server jenkins builds (usually connected git or other vcs), there's plugins upload builds hockeyapp automatically.

eclipse - Migrated to Android Studio - now my app requests additional permissions -

Image
i migrated app eclipse android studio. tried exporting signed apk , uploaded google play check working. that's when noticed app requests 2 additional permissions except ones have declared in manifest! 2 permissions android.permission.wake_lock , com.google.android.c2dm.permission.receive . what's going on here? haven't changed code since last time uploaded app, , manifest doesn't declare these permissions. i'm guessing google component responsible this, why did happen because migrated android studio? can turn off these permissions? i'm using google play services , google admob, i've been doing long time without these permissions...   manifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app" android:versioncode="70" android:versionname="7.0" > <uses-permissio

Fatal Python error when attempting to upgrade pip -

i'm trying upgrade pip version 8.0.2 version 7.1.2, however, when type python -m pip install --upgrade pip , command line, returns: fatal python error: py_initialize: unable load file system codec importerror: no module named 'encodings' current thread 0x00007cf8 (most recent call first): my pip --version returns: pip 7.1.2 c:\users\owner\anaconda3\lib\site-packages (python 3.5) i'm running windows 10, 64-bit operating system. edit: additionally, when type python in command line, returns: c:\users\owner>python fatal python error: py_initialize: unable load file system codec importerror: no module named 'encodings' current thread 0x00007cf8 (most recent call first): and python "stops working." edit 2: path: path=c:\program files (x86)\nvidia corporation\physx\common;c:\python27\;c:\python27\scripts;c:\program files (x86)\python332\;c:\programdata\oracle\java\javapath;c:\program files\common files\microsoft share

php - Laravel, using AS does not pass on view side -

i try count(message) number looks nothing wrong in controller side, in view side, getting error : error rendering view: [home.index] undefined property: stdclass::$number my view side , have code : foreach($sorgu $value) { case 'bul1': $sorgu99[0]+=$value->number; break; } $posts = db::table('xxx'); $posts = db::table('xxx')->select( array('message', db::raw('count(message) number'), db::raw('xxx.time time'))); $posts = db::table('xxx')->join( 'xxs', 'xxx.smscid', '=', 'rcs.smscid', 'inner'); $posts = db::table('xxx')->where('xxs.status','=','1'); $posts = db::table('xxx')->where( 'xxx.time' ,'>', '2012-12-26'); $posts = db::table('xxx')->where(db::raw('length(message)'), '>', '3'); $posts = db::table('xxx')->group_by

html - Equal Row Height in Sibling Flexbox Items/Columns -

i have multiple products heading, description , call-to-action. word count of each not regulated. using flexbox display these products containers of each item of equal height , can clear next row without having mess nth-child. my question this. there flex property (or other css property) can allow me match height of rows in separate columns? codepen http://codepen.io/fedaykin00/pen/yexolv desired outcome html <div class="container"> <div class="item"> <div class="item-row item-heading"> <h1>item 1: far far away</h1> </div> <div class="item-row item-body"> <p>far far away, behind word mountains, far countries vokalia , consonantia, there live blind texts. separated live in bookmarksgrove right @ coast of semantics, large language ocean. small river named duden flows place , supplies necessary</p> </div> <div class="item-row

Php-MySql Security approach while INSERT’ing INTO MySql & fetching from MySql to screen -

my approach while insert’ing mysql i think read in stackoverflow.com “if need escaping or similar action, in time need” in verification pages verify user inputs (null or not check, length check , structural checks (eg: mail structure, custom tags structures); use $_post[''] variables inputs. during verifications, in custom error printing parts, error messages not include of $_post[''] values in message texts. interim note: utilize prepared statements , parameterized queries during php-mysql interactions. if inputs verified; before insert’ing mysql, strip tags input since don’t allow html tags other custom structured tags. (for example **bold text** === <strong>bold text</strong> ) insert user input mysql db. my approach while fetching mysql & printing output screen i apply htmlspecialchars() command print out screen mysql db my question i not sure of myself. there obvious or hidden weakness in approach? in advance php gurus’ valuable c

objective c - NSArray from NSCharacterset -

currently able make array of alphabets below [[nsarray alloc]initwithobjects:@"a",@"b",@"c",@"d",@"e",@"f",@"g",@"h",@"i",@"j",@"k",@"l",@"m",@"n",@"o",@"p",@"q",@"r",@"s",@"t",@"u",@"v",@"w",@"x",@"y",@"z",nil]; knowing available over [nscharacterset uppercaselettercharacterset] is there anyway can make array out of it? the following code creates array containing characters of given character set. works characters outside of "basic multilingual plane" (characters > u+ffff, e.g. u+10400 deseret capital letter long i). nscharacterset *charset = [nscharacterset uppercaselettercharacterset]; nsmutablearray *array = [nsmutablearray array]; (int plane = 0; plane <= 16; plane++) { if ([charset

css - How to change label color of disabled checkbox in ASP.NET? -

how change disabled checkbox label of asp controls through css. check disabled label colour not changing tried through css, clue or hint css? use plus (+) sign adjacent element ( http://www.w3.org/tr/css21/selector.html#adjacent-selectors ) input[type="checkbox"]:checked+label{ font-weight: bold; } input[type="checkbox"]:disabled+label { color:#ccc; }

No OpenGL context found error in PlayN -

using playn, trying change image on square layer. trying create flip effect change images. doing setting origin of layer center of image, reducing width , changing image when width 0 (image not visible) , increasing width original size. i using custom timer task play transition. now have 1 question , 1 issue. question is there better way acheive trying do and issue image flips when click image again flip following error [java] exception in thread "timer-1" java.lang.runtimeexception: no opengl context found in current thread. [java] @ org.lwjgl.opengl.glcontext.getcapabilities(glcontext.java:124) [java] @ org.lwjgl.opengl.gl11.gldeletetextures(gl11.java:721) [java] @ playn.java.javagl20.gldeletetextures(javagl20.java:1050) [java] @ playn.core.gl.gl20context.destroytexture(gl20context.java:164) [java] @ playn.core.gl.imagegl.cleartexture(imagegl.java:60) [java] @ playn.core.gl.imagegl.release(imagegl.java:87) [java] @ playn.core.gl.imagelaye

Setting javascript variable to PHP array's specific index -

i have 1 (very) big php array (with 649 indexes). want set javascript variable specific index of , index depend on variable. there way? know can copy whole php array javascript array using json_encode($phparray) , don't want whole array loaded on client side (for speed , sort of security). $phparray[0] = "i first element"; $phparray[1] = "i second element"; /* ......... */ $phparray[100] = "i 100th element"; and now, let say, want second element of $phparray ? how can it? here example using jquery $.post method: $(document).ready(function(){ var my_var; $.post("my-php-page.php", {my_index: 1}, function(data) { my_var = data.my_value; }, "json"); }); my-php-page.php <?php $phparray[0] = "i first element"; $phparray[1] = "i second element"; /* ......... */ $phparray[100] = "i 100th element"; echo json_encode(array(&q

c# to f# - F# out parameters and value types -

the following f# function works great if pass references objects, not accept structs, or primitives: let trygetfromsession (entrytype:entrytype, key, [<out>] outvalue: 't byref) = match httpcontext.current.session.[entrytype.tostring + key] | null -> outvalue <- null; false | result -> outvalue <- result :?> 't; true if try call c# with: bool result = false; trygetfromsession(theonecache.entrytype.sql,key,out result) i the type bool must reference type in order use parameter there way have f# function handle both? the problem null value in outvalue <- null restricts type 't reference type. if has null valid value, cannot value type! you can fix using unchecked.defaultof<'t> instead. same default(t) in c# , returns either null (for reference types) or empty/zero value value types. let trygetfromsession (entrytype:entrytype, key, [<out>] outvalue: 't byref) =

java - Unable to attach to a running spring integration test using debugger -

i running spring integration test using maven. trying run debug port enabled can attach intellij idea. the following command line used work in past. used allow surefire bootup initialize, , wait attach port 8000 before continuing test: -dmaven.surefire.debug="-xdebug -xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -xnoagent -djava.compiler=none" -dtestintegration test however giving me following exception: [error] no plugin found prefix 'runjdwp' in current project , in plugin groups [com.zillow, org.apache.maven.plugins, org.codehaus.mojo] available repositories [local (/home/ferozed/.m2/repository-p4), nexus ( http://repo.zillow.local/content/groups/public)] -> [help 1] org.apache.maven.plugin.prefix.nopluginfoundforprefixexception: no plugin found prefix 'runjdwp' in current project , in plugin groups [com.zillow, org.apache.maven.plugins, org.codehaus.mojo] available repositories [local (/home/ferozed/.m2/repository-p4),

linux - Bash script with fdisk -

i came across bash script expand fs after making root volume larger on ami made packer. can please explain meaning of fdisk options in heredoc? #!/bin/bash fdisk /dev/xvda <<eeof d n p 1 1 w eeof exit 0 thank you! to determine these mean, @ built-in fdisk . details may differ based on implementation; mine, looks this: command (m help): m help: dos (mbr) toggle bootable flag b edit nested bsd disklabel c toggle dos compatibility flag generic d delete partition l list known partition types n add new partition p print partition table t change partition type v verify partition table misc m print menu u change display/entry units x functionality (experts only) save & exit w write table disk , exit q quit without saving changes create new label g create new empty gpt partition table g create new empty sgi (irix) partition table o create new empty dos partition ta

android - How to block keyboard when focusing on EditText -

in android application, have use custom number-pad placed in view next edittexts input numbers, need: edittext should have focus when user tap them have cursor position insert number when user hits key. soft keyboard should not appear when edit text focused (but cannot hide keyboard setting android:windowsoftinputmode="statehidden" because there search box in screen still need use soft keyboard) i have searched , found many articles hiding keyboard programmingly when being shown, or set input type/focusable....to not show keyboard....but not meet need. anybody have solution case please me. this 1 took inspiration csipsimple project , implemented own here code same create custom numberpad here mine layout dialpad buttons 1 9 , * # package com.xyz.custom; import java.util.hashmap; import java.util.map; import com.xyz.payphone.r; import android.annotation.suppresslint; import android.content.context; import android.media.tonegenerator; import andro

php - $_SERVER['REMOTE_ADDR'] is not giving ip address in wordpress plugin -

i'm building plugin wordpress create new payment gateway in woocommerce. in plugin, need send clients ip address api. well, $_server['remote_addr'] not giving me correct ip address when use in plugins php file. wc_geolocation::get_ip_address() not working too, both of them giving me servers ip if use them in plugin file. if use them in footer.php, gives me correct ip address. so, must not server configuration, actually, when try display clients ip in receipt page, in receipt section both of them gives me servers ip while give me correct ip in footer. what causes display servers ip address when using $_server['remote_addr']? are there alternatives? you can use function: // function client ip address static function get_client_ip() { $ipaddress = ''; if (isset($_server['http_client_ip'])) { $ipaddress .= $_server['http_client_ip'] . ' - '; } if(isset($_server['http_x_forwarded_for'])

What is the difference between "switch" and "filter" in Tracing in .NET? -

what difference between "switch" , "filter" in tracing in .net ? seem work in similar way. <system.diagnostics> <trace autoflush="true" indentsize="5"> <listeners> <add name="demolistener" type="system.diagnostics.textwritertracelistener" initializedata="d:\output1.txt"> </add> <remove name="default" /> </listeners> </trace> <sources> <source name="demoapp" switchname="demoapp"> <listeners> <add name="demolistener" type="system.diagnostics.textwritertracelistener" initializedata="d:\output2.txt"> <filter type="system.diagnostics.eventtypefilter" initializedata="error"/> </add> <remove name="default" /> </listeners>

c++ - Is passing a pointer by reference the correct way to do this? -

this function: void createrendertarget(hwnd, id2d1hwndrendertarget*); and there how works: void d2dres::createrendertarget(hwnd hwnd, id2d1hwndrendertarget* prt) { rect rc; getclientrect(hwnd,&rc); pfactory->createhwndrendertarget( d2d1::rendertargetproperties(), d2d1::hwndrendertargetproperties( hwnd, d2d1::sizeu( rc.right - rc.left, rc.bottom - rc.top)), &prt); } it called this: pd2dres->createrendertarget(map.gethwnd(),map.getprt()); once returning createrendertarget(), map.prt null. how comes? edit : there getprt() function: id2d1hwndrendertarget* mapeditor::getprt() { return prt; } first problem: once returning createrendertarget() , map.prt null . how comes? because not passing pointer by reference . in order pass reference, signature of createrendertarget() should be: void createrendertarget(hwnd,

java - Print the elements in the tree that start with a vowel in reverse alphabetic order -

in given binary search program have print elements in tree start vowel in reverse alphabetic order. unable it. leaving nodes without traversing. please help. public void reverseordertr() { reverseordert(root); } private void reverseordert(binarytreenode t) { if (t != null) { string v = t.nodedata; char tav = (character.touppercase(v.charat(0))); if (tav == 'a' || tav == 'e' || tav == 'i' || tav == 'o' || tav == 'u') { reverseordert(t.rightnode); system.out.print(t.nodedata + " "); reverseordert(t.leftnode); } } } you traversing subnodes of nodes vowel-starting data. move test deeper block, around print function.

Java encapsulation & array -

does returning copy of contents of array instead of direct reference improve encapsulation of class? i'm wondering if considered best practice. if understand correctly, trying encapsulate collection. if provide direct reference, there no encapsulation collection. user can want collection - set null. if providing deep copy of collection user, when modify copy, not modifying collection in class. the best practice encapsulate whole collection never giving user reference collection. instead, interface via class methods. if need iterate on whole collection, best return iterator on collection, provide read-only access it. say example have class bookcollection, has private list data member. if want consumers of code able add , remove books, etc., provide methods them so. here example code: public class bookcollection { private list<book> books; public bookcollection() { this.books = new arraylist(); } public void addbook(book book) {

excel vba - How to compare columns for unique data between two workbooks -

i want compare data column d in fortest1.xlsx column f in tested.xlsm. if matched, nothing. if not matched, copy column c in fortest.xlsx column c e in tested.xlsm. may know how can achieve this? code running without error, however, doesn't generate result. thanks in advanced. sub test() 'application.screenupdating = true dim wba workbook set wba = thisworkbook dim wbb workbook set wbb = workbooks.open(filename:="c:\users\maggie\desktop\fortest1.xlsx") dim sheeta worksheet dim sheetb worksheet set sheeta = wba.sheets("up") set sheetb = wbb.sheets("up") dim erowa integer dim erowb integer erowa = sheeta.range("f" & rows.count).end(xlup).row 'last line data in workbook (activeworkbook) erowb = sheetb.range("d" & rows.count).end(xlup).row 'last line data in workbook b (opened workbook) dim match boolean dim erow long dim i, j long dim r1, r2 range = 1 erowa set r1 = sheeta.range("f&q

dart - DartPad allows string iteration -

i'd know why code below prints each letter of test on dartpad , , throws exception on terminal . mean, strings in dart not iterable, don't understand how works on dartpad; i'd expect exception there well. ideias? void main() { var test = 'test'; (var t in test) { print(t); } } i tested dart 1.14.0, happening in previous versions well. i guess because dart converted javascript , javascript supports iterating on strings , performance reasons there no additional checks prevent it. what imho bug, analyzer doesn't show warning, when test explicitely typed string void main() { string test = 'test'; (var t in test) { print(t); } } when enable strong-mode, warning though. my_project/.analysis_options analyzer: strong-mode: true type check failed: test (string) not of type iterable for both var test = 'test'; // or string test = 'test';

Complexity of Lua stack operations (Lua C API) -

in lua c api, offers couple stack operation functions mentioned in lua's document int lua_gettop (lua_state *l); void lua_settop (lua_state *l, int index); void lua_pushvalue (lua_state *l, int index); void lua_remove (lua_state *l, int index); void lua_insert (lua_state *l, int index); void lua_replace (lua_state *l, int index); my first question is, complexity of these function? o(1) or o(|index|)? checked lua manual , seems lua has 2 different implementations of stack (stack based , register based). more specifically, if read , pop top 3 elements lua stack, can think of following 2 implementations, can know 1 more performant / suggested way? solution 1 -- read , pop each value: for (int = 0; < 3; ++i) { values[i] = lua_tostring(lua_state, -1); ... lua_pop(lua_state, 1); } solution 2 -- read , pop all: for (int = 0; < 3; ++i) { values[i] = lua_tostring(lua_state, -1 - i); } ... lua_pop(lua_state, 3); lua 5.3 defines lua_pop as

coremidi - Get iOS Core MIDI client name to show in list of devices -

i have got midi in working in ios app using core midi. however, if open app outputs midi (for example, free app little midi machine) app not show in list of possible devices (in case of lmm, in list named "coremidi outputs"), though app receives midi notes anyway. other apps show name (i.e. ims-20) how can "advertise" app other midi apps on same system? ok, after messing around while i've worked out. best explain, , if there errors in info, hope experts feel free chime in. there 2 ways receive midi messages core midi. either create midiportref input port midiinputportcreate, , iterate on possible sources, connecting each 1 in turn midiportconnectsource. or can create midiendpointref midi destination mididestinationcreate - there no need iterate on sources, , in both cases midireadproc needed - i.e. function use read incoming messages has same signature in both scenarios. when use mididestinationcreate, app shows in other apps destination can sel

scala - Is it possible to override the way play.api.libs.json write options? -

i work play! scala 2.4 , have several simple case class one: case class a(a: option[string]) i override way json.tojson(a) works when option empty. here have done: implicit val awrites: writes[a] = json.writes[a] implicit def ow[t](implicit w: writes[t]): writes[option[t]] = writes { case none => jsstring("[]") case some(t) => json.tojson(t) } json.tojson(a(a = none)) mustbe json.parse("""{"a":"[]"}""") but still parses class usual (i.e. {} instead of {"a":"[]"} like). can in order make test pass? this isn't possible using json.writes macro, because written specially handle option use readnullable[b] . means need need use combinators define writes[a] . unfortunately, defining writes object 1 field little more cumbersome 1 has more. implicit val awrites: writes[a] = writes(a => json.obj("a" -> a.a)) scala> json.tojson(a(none)) res8: play.api

kafka "stops working" after a large message is enqueued -

i'm running kafka_2.11-0.9.0.0 , java-based producer/consumer. messages ~70 kb works fine. however, after producer enqueues larger, 70 mb message, kafka appears stop delivering messages consumer. i.e. not large message not delivered subsequent smaller messages. know producer succeeds because used kafka callback confirmation , can see messages in kafka message log. kafka config custom changes: message.max.bytes=200000000 replica.fetch.max.bytes=200000000 consumer config: props.put("fetch.message.max.bytes", "200000000"); props.put("max.partition.fetch.bytes", "200000000"); you need increase size of messages consumer can consume doesn't stuck trying read message big. max.partition.fetch.bytes (default value 1048576 bytes) the maximum amount of data per-partition server return. maximum total memory used request #partitions * max.partition.fetch.bytes. size must @ least large maximum message size server al

Create multiple records in the same access table from one entry -

i building payroll prep solution multiple stores , 100 employees. there complex math involved multiple bonus , hours calculations. built out working model in excel, seems access better solution due sheer amount of records , complexity of processing has happen. haven't done lot in access. i need build data entry form user can enter multiple types of hours , processed separate records (1 regular, ot, dt etc...) using same employee information. each pay type has different gl codes etc... output report hr can use verify , enter proper hours. carrying hours records in 1 table field each pay type , employee information. i'm interested in whether makes sense versus separate table each hours type; or if carry in 1 table, best way process data capture (i need produce shows each employee, pay type etc in summary form. any appreciated. i can tell traditional way keep pay types in separate table. however, if pay types relatively stable and/or small in number ther

Rewriting URL and MySQL Query -

i'm looking understand something, , i've not find explanations this. read : how rewrite url? , in answer, can find : 2) rewriting product.php?id=12 product/ipod-nano/12.html seo expert suggest display main keyword in url. in following url rewriting technique can display name of product in url. rewriteengine on rewriterule ^product/([a-za-z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2 my question : how works ? how can retrieve words 'ipod-nano' rewriterule ???? does can me?

SignalR regular disconnection -

environment .net mvc5 iis8.5 websocket enabled ie11 windows 8.1 signalr 2.2.0 problem i've been running signalr web application 2 months, , noticed regular socket disconnection. checked console logs thoroughly , result quite surprising me. script12030: websocket error: network error 12030 this happens regularly below. 09 - 08:10:01 10 - 13:10:01 11 - 18:10:01 12 - 23:10:01 14 - 04:10:01 15 - 09:10:01 16 - 14:10:01 17 - 19:10:01 18 - 19:10:01 you can notice 5 hours of interval , happens @ 10:01. use reconnecting , disconnected , , reconnected callback ensure complete reconnection. i have no special setting, use default configuration. reason??

Events not being tracked in new Google Analytics (analytics.js) setup -

i have website using new universal analytics (analytics.js) track. setup , working (pageviews, referrals, etc.) using following code snippet: <script> (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o), m=s.getelementsbytagname(o)[0];a.async=1;a.src=g;m.parentnode.insertbefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'ua-39570713-1', 'site.com'); ga('send', 'pageview'); </script> that located before </head> tag. i using jquery fire off event. tested jquery alert message , getting called, isn't problem. here snippet fires when button clicked: $('#submitbutton').on('click', function() { ga('send', 'event', 'button', 'click', 'contact form'); }); n

html - Using z-index to sort SVG objects, parent containers and text -

i overlay svg objects on top of container, text in container must accessible user's mouse (in other terms, put text forward without it's parent following, vice-versa). current situation: i have 2 svg objects, style of z-index: 2 . then, have <div> container style of z-index: 1 , , finally, div contains child <text> element style of z-index: 3 . understanding of how z-index works, svgs should overlay container, text should stand out. however, appears text follows parent z-index , gets overlaid svgs. how should proceed keep text above svgs, while container remains behind? you need set <text> element position: relative; or position: absolute; . doing that? if not won't work. body { padding: 0; margin: 0; } div { background-color: yellow; width: 300px; height: 150px; z-index: 1; } text { font-size: 40px; z-index: 3; position: relative; } svg { position: absolute; top: 0px; z-index: 2;

javascript - d3.min.js Uncaught TypeError: a.map is not a function -

i'm starting use d3 , i'm trying work example using own json. code showing uncaught typeerror: a.map not function, json parsed, don't know can be. this code: <!doctype html> <html> <head> <meta charset="utf-8"> <title>step 1 - basic pie chart</title> </head> <body> <div id="chart"></div> <script type=text/javascript src="{{url_for('static', filename='d3.min.js') }}"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script> (function(d3) { 'use strict'; var width = 360; var height = 360; var radius = math.min(width, height) / 2; var color = d3.scale.category20b(); var svg = d3.select('#chart') .append('svg') .attr('width', width) .a

c# - devart dc.ExecuteQuery returns Object not set to an instance of an object -

i've upgraded devart 7.5 , few functions not working properly. specifically, i've got function returns ienumerable: protected ienumerable<budgettotals> gettotals(decimal groupid, decimal budgetid) { using (ssinpatdatacontext dc = new ssinpatdatacontext()) { object[] ids = new object[2] { groupid, budgetid }; string sqlstr = "..." var query = dc.executequery<budgettotals>(sqlstr, ids); return query; } } to point works fine, , return variable " query " holds correct values. the problem when calling gettotals object not set: ... var query = gettotals(grpid,bdgid); foreach(budgettotals bt in query) { ... } now, when control reaches "in" in foreach instruction exception thrown message "object not set instance of object" , puzzling me because a) working fine and b) object is set within gettotals funcion. i work things around changing return value ienumerable

android - Fragment's reference to mActivity becomes null after orientation change. Ineffective fragment state maintenance -

my application consists of several fragments. until i've had references them stored in custom application object, beginning think i'm doing wrong. my problems started when realized fragment's references mactivity becomes null after orientation change. when call getactivity() after orientation change, nullpointerexception thrown. have checked fragment's onattach() called before make call getactivity(), still returns null. the following stripped version of mainactivity, activity in application. public class mainactivity extends baseactivity implements onitemclicklistener, onbackstackchangedlistener, onslidingmenuactionlistener { private listview mslidingmenulistview; private slidingmenu mslidingmenu; private boolean mmenufragmentvisible; private boolean mcontentfragmentvisible; private boolean mquickaccessfragmentvisible; private fragmentmanager mmanager; @override public void oncreate(bundle savedinstancestate) {

Strict functional language which can be compiled into native code -

recently started looking @ functional languages make algorithmic parts of application more reliable. of course bumped haskell. prepared many surprises me laziness. simple things become , slow. so i'm wondering there language can use write small algorithms in functional style without unnecessary laziness causes more problems helps. the program should compiled win32/64 native code (preferably dll) , have comparable performance c++. ocaml closest haskell, it's strict , impure. it's successor ml . ocaml, ml, , haskell can compiled machine code on common platform. in experience, though, laziness great feature once sense how works.

apache - How can I check whether file exists or not in specific folder in .htaccess? -

this code, rewritecond %{document_root}application/public%{request_uri} -f [or] rewritecond %{document_root}application/public%{request_uri} -d rewriterule application/public/.* - [l] but when entered localhost/css/style.css 404 page, although application/public/css/style.css exists. i think mean: rewriteengine on rewritebase / rewriterule ^application/public/.* - [l] rewritecond %{document_root}/application/public%{request_uri} -f [or] rewritecond %{document_root}/application/public%{request_uri} -d rewriterule .* /application/public/$0 [l] the first rewriterule prevent following rule being executed when url starts /application/public/ . prevent following rule being applied more once, although unlikely happen in specific case. the second rule(-set) internally redirect request /application/public/ folder, if , if requested filename/directory exists in folder.

c++ - What's the proper way to cleanup an infinite loop application in Linux? -

i come windows environment, i'm bit lost making transition writing things in linux. say i've got simple c/c++ application so: int main(int argc, char** argv) { int h = open("something"); while (true) { // work usleep(10000); } close(h); } in windows, i'd use getasynckeystate() (or other sort of keyboard checking functionality) escape key, , break out of loop when pressed. way close(h) called, , i'd cleanup need to. the way i've been terminating applications in linux has been using ctrl + c , reading means sends sigint , , 'friendly' way cause application quit. however, in experience, that's caused sorta drop , close wherever when got signal (meaning post-loop cleanup never runs.) some have suggested use signal() listen sigint , others disagree method. (plus, tends create bit more differences between how things done between windows , linux, , i'd stay close possible running on both platf

php - Timezone helper for CakePHP -

i have built simple timezone helper cakephp app using various examples here on stack overflow saves users zone against user record. e.g. europe/london. to see helper: http://pastebin.com/vgivwqhj when user logs application, save date/time of when logged in can display list of logs user security reasons. e.g. $this->user->savefield('lastlogin', date('y-m-d h:i:s')); however date pull server date/time. how can make use of timezone of user amend it? i tried: $date = new datetime(null, new datetimezone($user['user']['timezone'])); and then: $this->user->savefield('lastlogin', $date->date); null... but if debug $date example: object(datetime) { date => '2013-04-01 15:22:32' timezone_type => (int) 3 timezone => 'europe/london' } 1.) doing wrong? how pull datetime object? 2.) way handle this? means have replace date() calls snippet users time. 3.) won't dates on website

python - Calling a Function within a secondary Function, or calling a Function defined within a larger Function -

i'm trying use python create small program, show current prices of theoretical portfolio, , offer option refresh portfolio, or new quote of choice. i can work in program, problem i'm having defined functions. if @ run_price1(), you'll notice identical of run_price(); run_price() located within update function. if take out of update function, update function doesn't work. if don't list somewhere outside of update function, later user input doesn't work. the question: looking either way call function defined within function, or way use defined function inside of secondary function. my code: import mechanize bs4 import beautifulsoup def run_price1(): mybrowser = mechanize.browser() htmlpage=mybrowser.open(web_address) htmltext=htmlpage.get_data() mysoup = beautifulsoup(htmltext) mytags = mysoup.find_all("span", id=tag_id) myprice = mytags[0].string print"the current price of, {} is: {}".form