Posts

Showing posts from February, 2013

regex - Regextract Google Spreadsheet - Extract text from multiline string -

i have same issue of this post but i'm using google spreadsheet. though it's not considered "programming" topic, regex syntax same. i need extract text between 2 tags. eg: start sample text end when apply regex syntax works: "start(.*)end" but if sample text contains new line not. hints? if want rid off new line character, 1 solution replace new line character "", e.g: =regexextract(regexreplace(a1, "\n", ""), "start (.+) end") if want keep new line character, try: =regexextract(a1, "start (\w+\n\w+) end") alternatively if want solution works strings , without new line character, try: =regexextract(a1, "start (\w+|\w+\n\w+) end")

java 8 lambda expression for FilenameFilter -

i going through lambda expression in java 8 when changed code of thread it's working fine new thread(new runnable() { @override public void run() { system.out.println("run"); } }).start(); is converted lambda expression as new thread( () -> system.out.println("hello thread") ).start(); but not able convert filenamefilter expression file file = new file("/home/text/xyz.txt"); file.list(new filenamefilter() { @override public boolean accept(file dir, string name) { name.endswith(".txt"); return false; } }); and unsuccessfully converted file.list(new filenamefilter () { (file a1, string a2) -> { return false; } }); it's giving error in eclipse multiple markers @ line - syntax error, insert ";" complete statement - syntax error, insert "}" complete block - syntax error, insert "assignmentoperator expres

php - Laravel 5 and Wordpress 4.1.1 in the same server -

this first time try , after day of trying stuck. not have lot of experience ubuntu perhaps missed obvious. i trying install wp (latest) , laravel 5 on ubuntu 14.04 installation in virtual box. want both work side side since wp take care of web site side of things , web app based on laravel 5. the result wordpress works ok when go http://domain.com/app blank page , infamous 500 error: failed load resource: server responded status of 500 (internal server error) what have missed. thanks! the directory structure: /etc/var/www/public_site - public web site (wordpress installed here) /etc/var/www/ (laravel 5 installed here) /etc/var/www/public_site/wp-admin, wp-content, wp-includes app (as laravel public folder) after reading multiple forum posts, have done: .htaccess in /public_site/ contains: # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewritecond %{re

java - Passing $routeParams from angularjs to spring-MVC controller -

this have in angularjs controller .when("/m:topicid", {templateurl: "mu", controller: "conmfs"}) app.controller('conmfs',function($scope,$routeparams){ $scope.otherid = $routeparams.topicid; }); this spring controller @requestmapping(value="/controlerm", method = requestmethod.get) public modelandview controlerm(httpservletrequest request, httpservletresponse response) throws exception { modelandview model = null; session=request.getsession(true); user = (user) session.getattribute("user"); list<ends1> ends=(list<ends1>) ifriendlistservice.getends(user.getid(),5); session.setattribute("mutualfriends", mutualfriends); model = new modelandview("ends"); return model; i able fetch topicid angularjs page in angularjs controller (with $scope.otherid ), unable pass value spring controller, redirecting new page. how should this? .when("/m:topicid", {templateurl:

c# - WPF share data between pages -

i'm new wpf, , wish know, if following possible. i have 2 wpf pages "page_parts" , "page_parts_edit". page_parts has link call page_parts_edit, , contents of entire page displayed within page_parts. page_parts contains datagrid parts in system. need able click on row within datagrid , pass selected row data textbox within child page "page_parts_edit". in essence allowing user select part details given selection. i'm able similar approach when both objects contained within same wpf page, in following manner: <textbox x:name="textpartnumber" text="{binding elementname=listviewpart, path=selecteditem.partnumber}" width="150" /> however, i'm not able use same approach when datagrid part of 1 page , textbox part of different page. perhaps creating array of strings, datagrid selected row updates linked dynamicresource, bind dynamicresource textboxes on other page. possible? i'm open other sugg

python - PySerial doesn't work in script -

i have problem script: #!/usr/bin/env python # -*- coding: utf-8 -*- import serial import time ser = serial.serial("com3", 9600, timeout=1) ser.write("test") print "test started\n" time.sleep(1) ans = ser.read(4) print ans in arduino echo program (everything has been sent arduino has been sent computer). serial monitor works fine. when i'm running python script stops on ser.read() (it waiting incoming data). when commands script i've written directly python console works without problems. why code started file didn't work? my os: windows 8.1 (64 bits) python version: 2.7.9 (64 bits) try way import serial import time ser = serial.serial("com3", 9600, timeout=1) ser.write("test") print "test started - data sent \n" while true: ans = ser.read(4) if and: print , time.sleep(1)

tkinter - Python Class Attribute Error 'Event' has no attribute -

i created code collaboration game few friends , making fun, , complete noob @ python. created class battle arena part of game: from tkinter import * import random root = tk() class battle: def __init__(self, monhealth): self.distance = 10 self.center = 5 self.monhealth = monhealth def left1(self): if self.center < 20: self.distance += 1 distance = abs(self.distance) self.center += 1 center = abs(self.center) print (str(distance) + " meters" + " " + str(center) + " meters") def right1(self): if self.center > -20: self.distance -= 1 self.center -= 1 center = abs(self.center) distance = abs(self.distance) print (str(distance) + " meters" + " " + str(center) + " meters") def lunge1(self): hit = [0,1,2,3,4] random.shuffl

html - enabling links in <frameset> issue -

Image
i have problem when i'm using godaddy.com (domain only) official option — mask url . i'll explain : feature's purpose "pin" same url browser when visiting website, no matter on page am. the purpose i'm using this : don't have hosting contract yet, i'm using heroku free hosting service , means long , "ugly" url address. the problem i'm facing : when entering source code of domain (in chrome - view-source:http://ravidgal.com/ ), see code godaddy "injects" in order perform masking operation is: <frameset rows="100%,*" border="0"> <frame src="http://radiant-stream-2083.herokuapp.com/" frameborder="0" /> <frame frameborder="0" noresize /> </frameset> that causes — no link on page can opened . when enter heroku url "manually" ( http://radiant-stream-2083.herokuapp.com/ ) can access links without problem. i'm sure problem &l

math - OpenGL - turn around projection -

i try turn around gui. have projection: glm::mat4 my_projection = glm::mat4( 2.0/static_cast<float>(m_window->getsize().x), 0.0, 0.0, -1.0, 0.0, 2.0/static_cast<float>(m_window->getsize().y), 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.0, 1.0); and shader: #version 330 core in vec3 pos; in vec2 uv; in vec4 col; uniform vec2 translation; uniform mat4 my_projection; out vec2 vecuv; out vec4 veccolor; void main() { vec3 tran_pos = vec3(pos + vec3(translation, 0.0f)); gl_position = vec4(tran_pos, 1.0f) * my_projection; vecuv = uv; veccolor = col; } and don't know how turn around, when change m_window->getsize().x to -m_window->getsize().x and m_window->getsize().y to -m_window->getsize().y everything disapear. how can turn around this? edit: (solution) glm::mat4 my_projection = glm::ortho(0.0f, (float)m_window->getsize().x,

php - Linker error using wininet in c++ -

this question has answer here: what undefined reference/unresolved external symbol error , how fix it? 27 answers i'm going upload data using wininet in c++. here code. #include "stdafx.h" #include "iostream" #include "windows.h" #include "wininet.h" #include "tchar.h" #include "iostream" #include "string" #include "sstream" #pragma comment(lib, "ws2_32.lib") int main(){ tchar hdrs[] = _t("content-type: application/x-www-form-urlencoded"); tchar frmdata[] = _t("name=john+doe&userid=hithere&other=p%26q"); lpctstr accept[] = {_t("*/*"), null}; hinternet hsession = internetopen(_t("myagent"), internet_open_type_preconfig, null, null, 0); hinternet hcon

css - Displaying responsive website on mobile devices exactly the same as on desktops -

Image
i have problem following website www.tylkomarkowa.pl basically it's responsive (bs 3.0), loads of custom queries. remove reponsiveness site, it's difficult. wonder if there way force mobile devices show full site, looks on desktops, without div stacking etc. i've tried viewport width=1200 , higher doesn't work @ all. have 1200px container on mobiles, if horizontal scrolling necessary. idea? thank you. i'm stuck. i've tried fixing width on container doesn't work too. firstly, removing responsiveness website terrible idea. drastically impact seo you've never seen before, google update coming april 21st take how mobile-friendly website very seriously . now i've made point, i'll show few steps can take remove feature. firstly, webkit browser, open debugging console, go sources tab. there, hit ctrl + shift + f allow search through of source file. type " @media ", , list occasions of @media query {} - responsive magi

hibernate - JPA ManyToOne in MappedSupperClass -

i trying create basic abstraction jpa entities. have base abstract class abstractmodel has id , version . think have abstract class extends abstractmodel adding auditing columns. have actual entities representing tables. have manytoone mapping in abstractauditmodel class doesn't seem it. is possible accomplish in mappedsuperclass ? my code below. abstractmodel.java @mappedsuperclass public abstract class abstractmodel implements serializable { @transient protected static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.identity) protected long id; @version protected long version; public long getid() { return id; } public void setid(long id) { this.id = id; } public long getversion() { return version; } public void setversion(long version) { this.version = version; } @override public abstract int hashcode(); @override publ

python - How can I capitalize a character with an odd-numbered index in a string? -

so doing our exercise when came across capitalizing characters in odd indices. tried this: for in word: if % 2 != 0: word[i] = word[i].capitalize() else: word[i] = word[i] however, ends showing error saying not strings can converted. can me debug code snippet? the problem strings in python immutable , cannot change individual characters. apart fro when iterate through string iterate on characters , not indices . need use different approach a work around is (using enumerate ) for i,v in enumerate(word): if % 2 != 0: word2+= v.upper() # can word2+=v.capitalize() in case # text 1 character long. else: word2+= v using lists wordlist = list(word) i,v in enumerate(wordlist): if % 2 != 0: wordlist[i]= v.upper() # can wordlist[i]=v.capitalize() in case # text 1 character long. word2 = "".join(wordlist) a short note on capitalize , upper . from docs capitalize

c++ - template operators fail seemingly on ambiguity -

this not duplicate. i've checked lots of answers, faq , else. nothing of told me news. here simplified code. it's minimum , explain error. /*** polynomial.hpp ********************************************************/ namespace modulus { // forward declaration of types , non-inline template friend functions. template <typename t> class polynomial; template <typename t> polynomial<t> operator + (polynomial<t> const & p, polynomial<t> const & q); } namespace modulus { template <typename t> class polynomial { public: polynomial() { } // [!] when comment in, error. //polynomial operator + () const { return *this; } friend polynomial operator + <> (polynomial const & p, polynomial const & q); }; } // namespace // template: include .cpp file. //#include "polynomial.cpp" ///^ commented out, compiling in 1 file.

How to change template URL at runtime in AngularJS? -

i have in app.js var app = angular.module('plunker', []); app.controller('mainctrl', function($scope) { // fetch data api calls var empdept = getemployeedata(); var marfin = getfinancedata(); var x = 1; $scope.list = {}; switch(x) { case 1: $scope.list = { employeedepartment: empdept }; break; case 2: $scope.list = { marketingfinance: marfin };break; } }); app.directive('mycustomer', function() { return { restrict: 'ae', scope: { customer: '=mycustomer' }, replace: true, templateurl: 'empdept.html' } }; }); and index.html under <!doctype html> <html ng-app="plunker"> <head> <meta charset="utf-8" /> <title>angularjs plunker</title> <script>document.write('<base href="' + document.location + '" />');</script&

django - social-auth gives "wrong" facebook id -

i use django social-auth facebook login , need facebook user id using in facebook chat xmpp. playing manually, knew id 10000xxxxxxxxxxxxx noticed social-auth holds id: 77061xxxxxxxxx4 request.user.social_auth.get(provider='facebook').uid both of them work , redirect fb account when in browser can't use facebook chat xmpp 1 social-auth has. please advice. it not wrong id, since v2.0 don´t global id anymore called "app scoped id". unique in 1 app , stay same, 1 in app. https://developers.facebook.com/docs/apps/changelog

java - Final Identifier is necessary, why? -

i try write program convert string integer . in defining method, gets error in identifier , , tells should final . "illegal modifier parameter stringtointeger; final permitted" know why should final ? public class stringtoint { public static void main(string[] args) { public static void stringtointeger(){ int = 24; string str = integer.tostring(i); int j = 23; string str2 = "" + j; int k = 22; string str3 = " " + k; system.out.println(str + "\t" + str2 + "\t" + str3); system.out.println(str + str2 + str3); system.out.println(); system.out.println(i + "\t" + j + "\t" + k); system.out.println(i + j + k); } } } you shouldn't put method inside main method. either drop public static void stringtointeger(){ method declaration, , put

node.js - How to pass session on proxy with ExpressJS? -

my app running on 3000 , have set proxy points 3000 subdomain name session not working on proxy. i have tried this: app.enable('trust proxy'); but doesnt work. nginx config listen 80; server_name sub.domain.com; location / { proxy_pass http://domain.com:3000/; proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection 'upgrade'; proxy_set_header host $host; proxy_cache_bypass $http_upgrade; } session config app.use(session({ store: sessionstore, //tell express store session info in redis store secret: 'mysecret', key: 'emre', saveuninitialized: false, proxy: true, resave: true, maxage: 60000 use simple cookie-based session middleware. https://www.npmjs.com/package/client-sessions https://github.com/expressjs/cookie-session

jquery - AJAX call, add loader only when loading posts -

i have ajax call on click on section i'll load posts (the featured images assigned them) category assigned section. works well, except few things. 1: have loader appear when images (from posts) being loaded second div. when loading of posts in div complete, div gets class triggers it's transition, it's visible, loader gets loaded class, , no ajax loader present. but, when click hide second div (gallery), loader appears again, , transition happens. how make on second click won't have loader , have transition hides div immediately? i'm doing wordpress. ajax looks this. var $content = $("#gallery"); var $content_inner = $("#inner_gallery"); var $fullpage = $('#fullpage'); var $gallerycat = $('#fullpage').find('.section'); var $close = $('.close'); var $loader = $("#loader"); var catid; var order; var orderby; $('#fullpage').find('.section').eq(0).addclass('first'); $gal

ios - Runtime error when trying to add a node declared in other class -

what i'm trying custom node class, in init creates it's own individual nodes (declared @properties, can access them anywhere. these nodes custom classes found here correct way create button in sprite kit? ). if try [self addchild:] these individual nodes in gamescene.m, crash giving runtime error. adding exception breakpoint tells me problem in line showed below, don't understand why. error "trying add nil node parent skscene name (null)", although gave node name. please push me in right direction. i'm absolute beginner ios development, , tried want achieve, no luck. source code: directionalpad.h #import "directionalbutton.h" @interface directionalpad : skspritenode @property(nonatomic)directionalbutton *dirbtnleft; @property(nonatomic)directionalbutton *dirbtnright; @end directionalpad.m -(void)addbuttons { //executed in init method nsstring *pathtoimageforleftbuttontexture = @"buttondirectionalleft"

c - Why is my program stopping before reading the txt file? -

my code keeps closing before reading file, made comment closes. know why wont work? showed lecturer couldn't figure out , had leave wondering if here figure out! #include <stdio.h> #include <stdlib.h> #define result_max = 100; #define result_min = 0; int main() { int studentid; char firstname[20]; char lastname[20]; int result; file *fptr; if ((fptr = fopen("student.txt", "w")) == null) { printf("file not opened\n"); //exit(0); } else { printf("enter id, first name, last name , result\n"); scanf("%d %s %s %d", &studentid, firstname, lastname, &result); while(!feof(stdin) ) { fprintf(fptr, "%d %s %s %d\n", studentid, firstname, lastname, result); scanf("%d %s %s %d", &studentid, firstname, lastname, &result); } fclose(fptr); }//else end

Ruby - passing by value or by reference -

i've searched on this, , seems ruby passes value, simple little example subset of larger program, , i'm little confused. a = "j123" b = a.slice!(0) puts puts b this displays 123 123 and don't understand why value of "b" changing. because both a , b pointers refer same object. aren't object itself. can pass pointers arguments in ruby, , pointers passed value. this similar java, javascript , python, , unlike c++, c#, haskell , scala. the difference of interest in following example: def f(y) y = 2 end x = 1 f(x) puts x # 1, not 2 if x passed reference, print 2 .

visual c++ - setting initial variable for base class from inherited class -

i little rusty c++ , getting bogged down simple question, apologies in advance. i have created child class existing library class , cannot work out how set initial state 1 of base class functions. basically have taken sfml circleshape class , added little of own, set origin derived objects fixed number. the base class takes 'name of class'.setorigin(x,y) straightforward, want know how set standard figure in derived class instances. (basically child class called ball , have class ball ball1, ball2 etc this may make clear have @ moment: //derived class----------------------------------------- class ball : public sf::circleshape { private: int horiz,vert,rate,radius; public: void sethoriz(int hin) { horiz=hin; } int gethoriz(int hout) { hout=horiz; return(hout); } void setvert(int vin) { vert=vin; } int getvert(int vout) { vout=vert; return(vout); } //----------------------------------------------- void setrate(int in) { rate=in; }

javascript - validate a form when using modal? -

Image
i try make form validation, if hit submit, form disapears before giving me feedback: <div class="ui right aligned grid"> <div class="ui 3 wide column"> <div class="ui center aligned inverted orange segment"> <div class="ui animated fade large inverted button" onclick="contact()"> <div class="visible content">say something!</div> <div class="hidden content">express ;)</div> </div> </div> </div> </div> <div class="ui first coupled modal"> <i class="close icon"></i> <div class="header"> tell me </div> <div class="content"> <form class="ui form" method="post" action="/msg"> <h4 class="ui dividing header">what think</h4> <div class=&qu

javascript - Installing Quojs -

i'm trying install quojs, gestures library got following error : typeerror: $$(...).tap not function any idea should work ? <!doctype html> <html> <head> <title>the touc project</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body> <h1>touc !</h1> <!-- js --> <script type="text/javascript" src="bower_components/quojs/quo.js"></script> <script type="text/javascript"> $$('h1').tap(function(e){ console.log('tap'); }); </script> </body> </html> check source url of quojs , try instead $$('h1').tap(function(){ console.log('tap'); });

c - Bool: Direct assignment or conditional? -

what's "proper" c way of assigning bool? #include <stdbool.h> a) bool a_state = (a_value > 0); b) bool a_state; if (a_value > 0) {a_state = true;} else {a_state = false;} c) bool a_state = false; if (a_value > 0) {a_state = true;} d) bool a_state = (a_value > 0)? true: false; which 1 clearer , more "c-like"? edit: added 2 more; added bool header #include its matter of choice. can go either. first snippet equivalent second.

javascript - creating a consistent simple banner text animation -

hey guys new javascriptand tried creating banner carousel animation , i.e, have 3 banners , everytime , slide comes in text appears animation , problem facing animations on 3 slides ony work till 3 slide scrolls after , when again slide 1 slides in , text on slide 1 not animated , animations don't happen here on . i inspired banner animations website : banner text animation inspiration . now have tried following css animations : @-webkit-keyframes bounceindown { 0%, 60%, 75%, 90%, 100% { transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); } 0% { opacity: 0; transform: translate3d(0, -3000px, 0); } 60% { opacity: 1; transform: translate3d(0, 25px, 0); } 75% { transform: translate3d(0, -10px, 0); } 90% { transform: translate3d(0, 5px, 0); } 100% { transform: none; } } .bounceindown { animation-name: bounceindown; } @-webkit-keyframes bounceinright { 0%, 60%, 75%, 90%, 100% { transi

java - What is my error in using a String in the case method -

i trying use scanner hold a string variable "how", , if "how" = yes execute. 'yes' case , if 'no' execute 'no' case inside else statement first question package test; import java.util.scanner; public class try { public static void main(string[] args) { system.out.println("hello world"); scanner input = new scanner(system.in); system.out.println("do wanna make android apps"); system.out.println("yes or no ?"); string copy=input.nextline(); system.out.println(copy); if(copy.equals("yes")) { system.out.println("you should continue java"); } else { system.out.println("do wanna make iso apps"); system.out.println("yes or no"); string how = null; switch(how.tolowercase()){ case "yes" : system.out.pr

css - tCSS: Don't break line for tags -

i have issues how tags showing on posts on website. have screenshot here displaying issue: http://i.imgur.com/vay3xfm.png the top pos shows how it's supposed look, tags within borders. see in second one, amount of tags breaks design. i'd i'd keep tags on 1 row, not displaying rest of tags, or showing "…" instead, can fit within borders. #tags{ font-weight:normal; font-size:11px; text-transform: lowercase; font-family: "goudy old style", palatino, "palatino linotype", "palatino lt std", "book antiqua", georgia, serif;color:{color:o main text}; padding-left:20px; width:350px; padding-bottom:5px; } #tags a{ color:{color:o main text}; } #tags hover{ color:{color:white main text}; } - <divabc class="reblog_etc" style="text-transform: lowercase;font-size:10px;height:20px;margin-top:0px;margin-left:0px;margin-right:0px;float:left;background-image:url(http://static.tumblr.com/ssdtkch/oohmg0ppe/midd

python - What are the benefits of having two models instead of one? -

i've django model class person(models.model): name = models.charfield(max_length=50) team = models.foreignkey(team) and team model class team(models.model): name = models.charfield(max_length=50) then, add 'coach' property 1 one relationship person. if not wrong, have 2 ways of doing it. the first approach adding field team: class team(models.model): name = models.charfield(max_length=50) coach = models.onetoonefield(person, related_name='master') the second 1 creating new model: class teamcoach(models.model): team = models.onetoonefield(team) coach = models.onetoonefield(person) is right ? there big difference practical purposes ? pro , cons of each approach ? i neither , every person has team , if every team has coach , it's rather redundant circulation , unnecessary. better add field in person called type directly more clean , direct, like: class person(models.model): # use _ if care i18n

perl - If statement with scalar conditional -

i having difficulty understanding following expression in perl . (my $attempts = 0; $attempts < $maxatt; $attempts++) { print "please try again.\n" if $attempts; print "$prompt: "; $response = readline(*stdin); chomp($response); return $response if $response; } what mean use scalar conditional? i.e. makes return true vs false? assuming statement reads if ($attempts) { print ... } . perl doesn't have distinct concept of "boolean value". per the perldata manpage : a scalar value interpreted false in boolean sense if undefined, null string or number 0 (or string equivalent, "0"), , true if else. boolean context special kind of scalar context no conversion string or number ever performed. so in example, if $attempts means if $attempts > 0 . incidentally, means $attempts > 0 not evaluate boolean, because there's no such thing. instead,

java - How to add text to new line -

i want add text new line. my code: textfield text = new textfield(); textarea area = new area(); string txt = text.getvalue().tostring(); area.setvalue("\n" + txt); when click in button see value textfield. want new text in new line in textarea. please help. you have append new value existing 1 , set that. along lines of: area.setvalue(area.getvalue() + "\n" + txt); the vaadin textarea has no direct way append. rules in java, when use + stringsapply. consider using stringbuffer , if alot.

android - CropResolutionPolicy and AdMob in andEngine not working together -

i try show ads in game. here method use that: @override public void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); //public void onsetcontentview(){ //super.onsetcontentview(); setcontentview(r.layout.activity_main); this.adview = new adview(this); this.adview.setadsize(com.google.android.gms.ads.adsize.smart_banner); this.adview.sety(50); this.adview.setadunitid("here goes id"); com.google.android.gms.ads.adrequest adrequest = new com.google.android.gms.ads.adrequest.builder().addtestdevice(com.google.android.gms.ads.adrequest.device_id_emulator).build(); this.adview.loadad(adrequest); relativelayout layout = (relativelayout)findviewbyid(r.id.relativelayout); relativelayout.layoutparams params = new relativelayout.layoutparams(relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content); layout.addview(this.mrendersurfaceview); layout.addview(this.adview, par

android - Admob real ads not showing -

i having problems in showing ads on android app. able show ads using adview adview = (adview)findviewbyid(r.id.adview); adrequest adrequest = new adrequest.builder(). addtestdevice("127544499e3830865bd4e63234b4cc99").build(); adview.loadad(adrequest); but when wanted show real ads, removed addtestdevice("127544499e3830865bd4e63234b4cc99") but showing nothing, plain white. have idea, looked @ question nothing works, correct admob account , having permissions,activity & meta in manifest. look @ logcat, tell why aren't showing ads. it's because there aren't show right now. normal situation.

asp.net mvc - C# regular expression format -

i want allow following 3 digit strings accepted: 083, 084, 085, 086, 087, 088 or 089 at moment i'm using: [regularexpression("^08\\{1}$", errormessage = "please enter valid 3 digit area code")] but accepts 081 , 082 i've tried using: [regularexpression("^08\\[3-9]{1}$", errormessage = "please enter valid 3 digit area code")] but it's not working me the regex should [regularexpression("^08[3-9]$", errormessage = "please enter valid 3 digit area code")]

android - Listview design with in two section -

Image
is there default way design listview 2 section different viewitems? both section must increase height according content , each section should able hide idependantly .the example of listview talking given in below image first thought take 2 listview saperated textview in 1 parent scrollview realised 2 listview have 2 independent scrollview. need 1 scrollview both section. how achieve such gui given below? don't need code. want hint. thanks. override getitemviewtypecount() in adapter return 2 in case if want 2 different types of views. override getitemviewtype(int pos) tell adapter's getview(...) how treat different views. create 2 different view holders. finally in getview(...) after querying view type (by mentioning in model) inflate corresponding view , instantiate corresponding view holder , voila you're done. also refer examples of view holder pattern in list views if not clear.

ruby on rails - Why root route not working with users#show? -

i tried root route root 'users#show' user taken profile upon logging in, instead i'm confronted error: activerecord::recordnotfound in userscontroller#show couldn't find user 'id'= @user = user.find(params[:id]) when use profile own tab via, <li><%= link_to "profile", current_user %></li> works, can't put root 'current_user' or error: argumenterror missing :action key on routes definition, please check routes. root 'current_user' thank time. actually, error message you've provided points problem. if have root defined you've mentioned root "users#show" executes show action of userscontroller , if have action implemented "the standard way": def show @user = user.find(params[:id]) end it fails here, because there no params[:id] . value fetched url. if you're pointing url: localhost:3000/users/1 the params[:id] has value "1". because yo

python 2.7 - Replace specific character from the list of string -

gurus, i have list looks following : [u'test1', u'test2', '', ''] i trying find way replace character u before 'test1' , 'test2' none ''. after replacing like: ['test1','test2', '', ''] initially had list following: [u'test1\n', u'test2\r\n', '', ''] this reduce using following: row_val = [w.replace('\n', '') w in row_val] row_val = [w.replace('\r', '') w in row_val] let me know there way perform same without iterating through each string. the u not string character, telling unicode object rather str object. you can do: row_val = [str(w) w in row_val]

java - Android: code refactoring advice -

i creating todo list kind of app. app 7 screens set target , complete that. screenshot here . while coding realized there lots of redundancy in code, like: 1> 7 day of week need create 7 fragments 7 fragments need perform same operations. can w/o 7 fragments? 2> there 15 checkboxes , 15 textview all-i need reference, perform onclick operations separately on each 1 , settext , gettext on each user try modify them. here 1 of textview modify code: ptext2 = (textview) view.findviewbyid(r.id.p_textview2); ptext2.setonlongclicklistener(new view.onlongclicklistener() { @override public boolean onlongclick(view view) { alertdialog.builder alertdialog = new alertdialog.builder(getactivity()); alertdialog.settitle("target"); alertdialog.setmessage("set target"); final edittext input = new edittext(getactivity()); alertdialog.setview(input);

php - Messages table in MySQL, getting last message for each thread -

i trying last message each conversation, problem not using conversations table. i using 1 messages table, table columns looks this: id from_id to_id text isread isseen created_at updated_at right able retrieve conversations this: $messages = message::select('*')-> from(db::raw("(select * `messages` `to_id` = ".auth::id()." order `created_at` desc) sub"))-> groupby('from_id')->orderby('created_at', 'desc')-> paginate(7); the downside not retrieving last message each conversation, retrieving last message received. how can retrieve last message of each conversation? example retrieve user63 conversations , last message each conversation: id from_id to_id text isread isseen created_at updated_at 23 224 63 0 0 2015-03-28 22:23:54 2015-03-28 22:23:54 20 63 225 b 0 0 20

mysql - ERROR 1062 (23000) at line 3907: Duplicate entry '1985' for key 'PRIMARY' -

after trying import database.sql, received error. error 1062 (23000) @ line 3907: duplicate entry '1985' key 'primary' i've tried read here don't understand them. there solution can use import database properly? thanks, you have same primary key in import file. go line , remove line or second possibility set flag ignore ids have inconsistent data , dublicate primary key. how skip row when importing bad mysql dump

javascript - And Query on Parse Cloud code -

this looks trivial query can't seem make work.. trying instance object has locationname = "nyc" , groupname = "adults". trying query using code found on parse documentation: var groupquery = new parse.query("mytable"); groupquery.equalto("group", groupname); var locationquery = new parse.query("mytable"); locationquery.equalto("location", locationname); var mainquery = parse.query.or(locationquery, groupquery); but fail because using parse.query.or instead should have been parse.query.and which, reason doesn't exist... there alternative way it, reason cannot find on documentation.. cheers parse queries use , default, why there parse.query.or(). want can achieved way : var mainquery = new parse.query("mytable"); mainquery.equalto("group", groupname); mainquery.equalto("location", locationname);

c# - how to get dynamic value using string instead of key? -

i have web api controller looking similar this: public void post([frombody]dynamic postdata) { foreach (var row in postdata) { var email = row.email.value; // ok var eventtype = row.event.value; // cannot use because "event" reserved .net, c# or whatever } } i'm getting json external system contains "event" property (outside of control), i'm unable retrieve. i've tried dozens of workaround, none of them seemed work in scenario. there easy way of retrieving it. the best bet had using reflection like: row.gettype().getproperty("event").getvalue(row, null); but didn't work had expected. there else can try? solution use "@" like: row.@event.value

java - Weak Math Skillset: What is an 8-bit numerator and 8-bit denominator? -

i'm embarrassed wield weak math skills, , proud computer science major. i'm in class, , it's overwhelming. part of homework assignment, however, can't continue on until understand section. in class struggling on writing method complete assignment. emailed professor, asking clarification on how method should written. he said supposed store 8-bit numerator , 8-bit denominator... however... not understand numerator , denominator is. can please explain me? this part of response got professor: "[you're] supposed encode coefficients a, b, , c chromosome [ chromosome our interface, chromosome chrome our object]. a, b, , c numbers can fractional. must store 8-bit numerator , 8-bit denominator. a, b, , c can positive or negative." after this, we're supposed map a, b, , c binary string create new chromosome object. how translating this: a, b, , c going doubles (at least) holding decimal value. can't implement until know 8-bit numer

linux - Getting parent directory from struct file -

how parent directory struct file* in linux kernel driver? i want information parent, , parents parent directory. the dentry , have been looking moved beeing direct child of struct file struct path . struct inode* parentdirinode(struct file* file) { return file->f_path.dentry->d_parent->d_inode; } still hope there better solution not break when change implementation structure. are there macros/functions overlooked?

linux device driver - OLED on Zedboard -

i new zedboard. have zedboard running ubuntu image. trying write driver run oled on board. on board start-up oled on board shows display(xilinx logo), therefore assuming has driver. have following questions: a) how oled in zedboard internally connected, through spi, gpios or pl. if it's through spi/gpios pins? b) tutorial or documentation can follow create userspace drivers using spi/gpio oled in zedboard? c) have redhat desktop, there sdk can use develop userspace drivers zedboard redhat desktop. i have seen lot of materials on zedboard none of them talks how oled internally connected. in 1 document shows it's connected pl. if that's case how can write userspace drivers using pl on zedboard? coding using c. appreciate , in advance! a) how oled in zedboard internally connected, through spi, gpios or pl. if it's through spi/gpios pins? first or second result web search "zedboard oled pdf" - http://zedboard.org/sites/default/files/z

php - Use Laravel 5 Illuminate\Html without Composer -

ok, need use illuminate\html package without composer. i'm using plesk, has php 5.3 installed default. managed add version of php (5.5) using fastcgi run side side. allowed me install laravel (since didn't play 5.3). i've got setup , working, when try install illuminate\html access form facade, i'm getting error message: fatalerrorexception in compiled.php line 6466: class 'illuminate\html\htmlserviceprovider' not found i installed composer, because plesk runs php 5.3 default, , composer runs default php, following errors: ./composer.json has been updated loading composer repositories package information updating dependencies (including require-dev) requirements not resolved installable set of packages. problem 1 - installation request illuminate/html 5.0.* -> satisfiable illuminate/html[v5.0.0]. - illuminate/html v5.0.0 requires php >=5.4.0 -> php version not satisfy requirement. problem 2 - league/flysystem 1.0.2 requir