Posts

Showing posts from August, 2015

c# - How to compare viewmodel and dependency in unit testing? -

below code of method :- [httppost] public actionresult index(productviewmodel model) { if (model != null) { return partialview("_productgrid", getproduct(model)); } else { return redirecttoaction("index", "product"); } } and below code unit testing method (in c#,mvc) :- [testmethod] public void index_withmodel_posttest() { //arrange productcontroller controller = new productcontroller(); var model = new productviewmodel() { name="product1", description="desc" }; //act partialviewresult actual = controller.index(model) partialviewresult; if (actual != null) { var viewmodel = (productviewmodel)((viewresultbase)(actual)).model; int matches = _productservice.getdeals("", model

c++ - Remove an item from a list-view control -

i have list-view control in program , want remove selected item. done button press. the problem no matter item select deletes first one... i think problem list-view focus being lost. when button pressed, list-view loses focus first, tries remove item that's not selected anymore, removes first one. my question is: there option make list-view not lose focus? edit: here's code : stdafx.h // stdafx.h : include file standard system include files, // or project specific include files used frequently, // changed infrequently // #pragma once #include "targetver.h" #define win32_lean_and_mean // exclude rarely-used stuff windows headers // windows header files: #include <windows.h> #include <windowsx.h> #include <commctrl.h> // c runtime header files #include <stdlib.h> #include <malloc.h> #include <memory.h> #include <tchar.h> // todo: reference additional headers program requires here main.cpp #include

Programming ARM CM3 into ROM & RAM -

currently i'm making step upgrade spare-time projects use of arm instead of 8bit micros microchip. but unfortunately ran problems: i not understand differences in ways of programming: - programming rom - programming ram (which 32k in case) i did "hello world" tests iar ide compiling/programming done given configuration didn't worry about. didn't iar ide , 32k limit of iar compiler decided set new environment (see configuration below). after setting eclipse environment, using examples provided iar managed program arm ram. when wanted program arm rom program doesn't seem anything. used example makefiles believe did sort of mapping rom or ram, had define 1 of them each time. i know rom read-only memory , wont empty after power has been disconnected , ram faster requires program downloaded arm each time. do need devide program parts of rom , ram, or can program rom in way arm remap code ram when powered up? currently using following configuration

mysql - The requested URL /phpmyadmin was not found on this server -

error occurring when opening www.mysite.com/phpmyadmin not found the requested url /phpmyadmin not found on server. apache/2.2.22 (ubuntu) server @ myclassbook.in port 80 i using digitalocean server hosting services. i have completed installation of apache2, mysql, php , phpmyadmin. i have inserted link /etc/apache2/apache2.conf , servername localhost apache2.conf file. include /etc/phpmyadmin/apache.conf but still not working. my hosts file 127.0.0.1 localhost 12.23.53.342 mysite.com my 000-default file serveradmin webmaster@localhost servername mysite.com documentroot /var/www/mcb/public <directory /> options followsymlinks allowoverride </directory> <directory /var/www/mcb/public/> options indexes followsymlinks multiviews allowoverride order allow,deny allow </directory> scriptalias /cgi-bin/ /usr/lib/cgi-bin/ <directory "/usr/lib/cgi-bin"> allowo

c++ - How to allow template class instantiation only if the type T derives from type X? -

template <typename t> class test { }; class : public x; class b; test<a> a; // ok test<b> b; // not ok i accomplish this. maybe can accomplished more easily. basically, need this: template class t should able lock std::mutex member m_mutex in object of type t if exists. with static assertion , appropriate type trait class : #include <type_traits> template <typename t> class test { static_assert( std::is_base_of<x,t>::value, "t doesn't derive x!"); }; live example .

android - FragmentStatePagerAdapter with subsets of fragments -

this problem has ben bugging me longer willing admit, came here help. i am, afaik, restrained using fragmentstatepageradapter display fragments due bitmaps , ooms on android. i implementing game, , have set of fragments. of these fragments can locked, , should not shown when swiping through list. for instance: i have set containing 1..10 fragments. in set, fragment #5,#6 , #7 locked. means have 2 subsets (1..4 , 8..10) of unlocked fragments. the functionality i'd have, swipe #1 #4 , swipe #8 #10. it should not able swipe #4 #5, , should not possible swipe between 2 subsets. when displaying fragment #4, should function if #4 end of list. accordingly, when displaying #8, should appear #8 @ start of list when being in other subset. is there suggestions? have tried override getitem , passing in subsets, has resulted in either npes or displaying wrong fragments.

ios - Why won't my model save to Core Data? -

i'm quite new objective-c , i'm trying mess around core data. have following app delegate interface , implementation: #import <uikit/uikit.h> @interface sdtappdelegate : uiresponder <uiapplicationdelegate> @property (strong, nonatomic) uiwindow *window; @property (nonatomic, strong) nsmanagedobjectcontext *managedobjectcontext; @property (nonatomic, strong) nsmanagedobjectmodel *managedobjectmodel; @property (nonatomic, strong) nspersistentstorecoordinator *persistentstorecoordinator; - (void)savemanagedobjectcontext; - (nsmanagedobjectcontext *)setupmanagedobjectcontext; - (nsmanagedobjectmodel *)setupmanagedobjectmodel; - (nspersistentstorecoordinator *)setuppersistentstorecoordinator; - (nsurl *)applicationdocumentsdirectory; @end implementation #import "sdtappdelegate.h" #import "todoitem.h" @implementation sdtappdelegate - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchopti

The Admob interstitial doesn't work in my Android app -

i copied code of interstitial here https://developers.google.com/mobile-ads-sdk/docs/admob/advanced doesnt' work. when app calls method interstitial.isloaded(), crashes. logcat: 04-06 14:40:09.320 29704-30638/? w/dalvikvm﹕ threadid=16: thread exiting uncaught exception (group=0x4145e438) 04-06 14:40:09.330 29704-30638/? e/androidruntime﹕ fatal exception: thread-3225 java.lang.illegalstateexception: isloaded must called on main ui thread. @ bkm.b(sourcefile:174) @ xx.e(sourcefile:210) @ yh.ontransact(sourcefile:66) @ android.os.binder.transact(binder.java:326) @ com.google.android.gms.internal.ac$a$a.isready(unknown source) @ com.google.android.gms.ads.interstitialad.isloaded(unknown source) @ com.myapp.gameactivity.displayinterstitial(gameactivity.java:75) @ com.myapp.gameactivity$gameview.ondraw(gameactivity.java:300) @ com.myapp.gameactivity$gameloop.run(gameac

JavaScript template code inside PHP -

i have template system gets info table of database. example <%=flight.flightnum%> shows flight number. it's made way parse info javascript popup window on google map. i want able add inside php code error getting parse error: syntax error, unexpected '<' on line 137 . line 137 is. if((<%=flight.flightnum%> > 3000) && (<%=flight.flightnum%> < 3499)) i assuming doesn't template code inside php tags. how can put them inside php tags? thinking pass javascript output php variable $flight or something, possible? this code want achieve. <?php if((<%=flight.flightnum%> > 3000) && (<%=flight.flightnum%> < 3499)) { echo '<center><img src="'.site_url.'/lib/skins/airline/images/divisions/regional.png"></center><br/>'; } else if((<%=flight.flightnum%> > 9900) && (<%=flight.flightnum%>

c++ - Android build Error on OSX 10.8.5: cp: the -R and -r options may not be specified together -

i'm trying compile android fs, on osx 10.8.5, , i'm getting error seems related fact build being done on osx. i did brew installations , compilation being done on case-sensitive fs, yet i'm getting following: target arm c++: libwebrtc_apm <= out/target/product/generic/obj/static_libraries/libwebrtc_apm_intermediates/proto/external/webrtc/src/modules/audio_processing/test/unittest.pb.cc symlink: out/target/product/generic/system/vendor/lib/libbltsville_cpu.so -> ./libbltsville_ticpu.so symlink: out/target/product/generic/system/vendor/lib/libbltsville_ticpu.so -> ./libbltsville_ticpu.2.1.0.0.so install: out/host/darwin-x86/bin/minigzip cp: -r , -r options may not specified together. make: * [out/target/product/generic/system/vendor/lib/libbltsville_ticpu.so] error 1 make: * deleting file `out/target/product/generic/system/vendor/lib/libbltsville_ticpu.so' make: * waiting unfinished jobs.... any ideas? i know -r can solve issue, bu

php - How do rewrite underscore to dash without mod_rewrite -

i using php-login.net model mvc framework site. however, view/controller setup works urls underscores: domain.com/this_is_a_subdir current seo best practice suggests using hyphens separators, google not recognise underscore separator: domain.com/this-is-a-subdir if 1 attempts use dashes ( - ), results in internal server error 500. i told because first , second part of url represent class/controller name , according method/action. , in php classes , function names cannot have dashes in them. advice here suggests use either mod_rewrite or use "the parameter content url, wordpress etc do". i'm interested in how latter of these solutions work, explain involve/where might start?

Saving list from python to text file in format -

say have txt file, fantasy,12/03/2014 sci-fi,13/04/2014 history,03/04/2014 and use following code convert python list def load_list(filename): my_file = open(filename, "ru") my_list = [] line in my_file: a,b = line.rstrip("\n").split(",") my_list.append((as_datetime(b),a)) my_file.close() return my_list which outputs [(datetime.datetime(2014, 3, 12, 0, 0), 'fantasy'), (datetime.datetime(2014, 4, 3, 0, 0), 'history'), (datetime.datetime(2014, 4, 12, 0, 0), 'sci-fi')]. i can assume list further modified (appended , removed) while being used. question is, how can implement function export list txt file followed formatting of original file? you can use csv module reading , writing. in order follow date format, use strptime() , strftime() ( docs ) datetime module. here's complete example: import csv datetime import datetime format = '%d/%m/%y' d

mongodb - Namespaced Collections in Meteor -

i'm developing meteor application based on different packages (maybe created different developers). my question if there's meteor'ish way namespace collections won't collide other available collections. for example, have package uses collection name 'todos' , 1 may include collection name 'todos'. there way namespace these collections (e.g. package-name prepended)? i've found out there's option namespacing in mongodb '.': http://docs.mongodb.org/manual/faq/developers/#what-is-a-namespace-in-mongodb is best way namespace collections in meteor? coming meteor rails background, can remember can create namespaced engines in rails (which creates namespaced database-tables). there similar in meteor? the closest came issue i've found: https://github.com/collectionfs/meteor-cfs-gridfs/issues/6 thanks in advance! using period in collection name fine namespacing scheme meteor collections if using mongodb alone. var t

php - Accents and special characters in MySQL -

i have got problem accents , special characters such as: ñ, ç... i use following code introduce data on mysql db: $artist = mb_convert_encoding(mb_convert_case($_post["artist"], mb_case_title), "utf-8"); $title = mb_convert_encoding(mb_convert_case($_post["title"], mb_case_title), "utf-8"); $name = mb_convert_encoding(mb_convert_case($_post["name"], mb_case_title), "utf-8"); $query = $db->prepare("insert songs (artist, title, name) values (?, ?, ?)"); $query->execute(array($artist, $title, $name)); an example fails (artist of song / title of song / ádam gracia). inserted as: artist of song / title of song / Ãdam gracia) the worst of locally (localhost), works perfectly, on hosting, gives above output. same happens ç, ñ, etc.. i have tried changing encoding options @ php admin, don´t know do... thank all! try set charset in connection : new pdo("mysql:host=$dbhost;dbname=$dbnam

apache - PHP Warning: Cannot modify header information - headers already sent by -

this question has answer here: how fix “headers sent” error in php 11 answers i know has been asked million times can't seem find answer helps mine. i started new php website , saw in title keeps saying: warning: cannot modify header information - headers sent (output started @ /customers/e/7/8/andersws.dk/httpd.www/template/index.php:2) in /customers/e/7/8/andersws.dk/httpd.www/template/index.php on line 4 all in file far is: <!doctype html> <? if(file_exists('first.run')){ header('location: index.php'); } ?> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <?php // put code here ?> </body> </html> so can't see i'm doing wrong. it's because s

What does dim highlighted properties of a JavaScript object signify in Chrome Dev tools? -

Image
i wanted know properties of object when see in scope variables or hover on them(in chrome developer tools) appears dim highlighted. signify? //sample code 'use strict' function myclass(first, second) { // this.pehla = first; var private_var = 'i_am_private_variable'; this.doosra = second; object.defineproperty(this, 'pehla', { value: '_haani_constant', writable: false }); }; var instanceofclass = new myclass('1', '2'); console.log(instanceofclass.pehla); console.log('assigning value pehla'); console.log("instanceofclass.pehla = 'someothertext' "); try { instanceofclass.pehla = 'someothertext'; } catch (e) { console.log(e.message); } see image reference the properties not enumerable shown dimme

javascript - missing binded value in angularjs -

http://plnkr.co/edit/hlsmpwp6o2ul4shethlr?p=preview i use push {{tab.tabname}} return blank (line 46) in index.html this problem: (in app.js, under addtab function) "name" : capitalisefirstletter(this.newtabname), should be: "tabname" : capitalisefirstletter(this.newtabname),

python 3.x - How do I put more than one label into a frame using tkinter? -

i trying put label underneath label on frame in tkinter either 1 label printing on top of other or seem frame doubled underneath itself. how fix problem? this code using: class teachingcontent(tk): def __init__(self): super(teachingcontent, self).__init__() self.nextlabel = none self.nextlabeltext = stringvar() self.nextlabeltext.set("next window") self.tutortitlefont = font.font(family='helvetica', size=16, weight='bold') self.tutorcontentfont = font.font(family='helvetica', size=14, weight='normal') self.tutorcodefont = font.font(family='helvetica', size=12, weight='normal') self.tutorbuttonfont = font.font(family = 'helvetica', size=12, weight='bold') self.title_height = 40 self.firstprogram_title_frame = ttk.frame() self.firstprogram_frame = ttk.frame() def nextbuttonpressed(self): pass

actionscript - How to control an flash nested movie clip instance with buttons situated in different movie clip (Action Script 2.0)? -

i working on action script 2.0 based flash file. trying control movieclip instance named "xyz" located in different object. i used: [code]_root.gotoandplay(4)[/code] now question how control flash nested movie clip instance buttons situated in different movie clip. the code mentioned above takes me start/root of main animation. want deal particular movieclip. i have assigned label movie clip "xyz", not find way call object , play/show particular frame. help please. say have mcchild nested inside mcparent , situated on main timeline. control mcchild main timeline (or _root ), can following: mcparent.mcchild.gotoandstop(3); in case, you'd need this: parentinstancename.xyz.gotoandstop(2); //2 example, of course. but, work, need assign instance name movieclip contains xyz movieclip. also, works multiple levels of nesting. e.g. mc1.mc2.mc3.gotoandstop(5);

ios7 - Is there a way to send a link via sms or other application in iOS? -

Image
i have button on each cell of table. when button pressed want sms screen open , have prepopulate unique link. i've done in android using android.intent.action.send i'm not sure how in ios. in android when user clicks button, android automatically gives user several options share url (facebook/twitter/sms/gmail/etc). prefer happen, if isn't possible opening sms screen sufficient. i imagine possible in ios? i'd recommend using uiactivityviewcontroller should show of apps on device capable of sending link. work setting contents of message though; unfortunately, doesn't seem it's possible set recipient using technique . nsstring *text = @"click on link!!"; nsurl *url = [nsurl urlwithstring:@"http://google.com"]; nsarray *itemstoshare = @[text, url]; uiactivity *activity = [[uiactivity alloc] init]; nsarray *applicationactivities = [[nsarray alloc] initwithobjects:activity, nil]; uiactivityviewcontroller *activityvc =

ios - XCode 5 calling class with prepareforsegue -

i have tableview within container view. when user selects of rows, method called in parent controller, tells parent controller perform segue. however, unable figure out why doesn't work. code gets called didselectrow -function in tableview. method perform, gives me error no segue identifier. however, when call method(listjobsofsite) within parent view controller works. (tableview) -(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { [self.jobvc listjobsofsite:@"locpwn"]; } parent view controller -(void)listjobsofsite:(nsstring *)site { [self performseguewithidentifier:@"jobsegue2" sender:nil]; } edit: segue between view controller 1, , view controller 2. view controller 1 holds container view, again holds table view controller. tableview controller should tell view controller 1 segue view controller 2. edit 2: screenshot http://tinypic.com/r/30x7dr9/8 you don't call classes. word

R iGraph graph.bfs and environment -

having trouble running breadth-first search algorithm on graph, current concern environment parameter, callback function evaluated. this callback function f.in <- function(graph, data, extra) { time <- get.vertex.attribute(graph, "time", index=data["vid"]) root_time <- get.vertex.attribute(graph, "time", index=extra) print(ls(environment())) if (time != 0){ time_difference <- time - root_time result_list <- c(list(), time_difference) } } this context functions called graphs <- decompose.graph(network_graph, max.comps = na, min.vertices = 0) lapply(graphs, function(g){ v0 <- which(degree(g, mode="out") == 0) t0 <- get.vertex.attribute(g, "time", index=v0) if (t0 != 0) { bfs_environment <- new.env() assign("result_list", list(), envir=bfs_environment) graph.bfs(g, v0, neimode="in", callback=f.in, extra=

php - Wordpress posts are not showing at external page of website -

i working on website...besides..i want put page iframe , want show wordpress post in page.. the problem is not showing anything...when code executed..can please @ going wrong? here link page as: http://www.webngraphicssolutions.com/universal/wp-content/themes/universal/content/register.php here iframe page code : <?php require('http://www.webngraphicssolutions.com/universal/wp-blog-header.php'); ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>register page</title> <link href="reset.css" rel="stylesheet" type="text/css"> <link href="style.css" rel="stylesheet" type="text/css"> <link href="jquery.sb.c

web services - VSTO web interaction -

in php can use code: $url = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=$location1& destinations=$location2&mode=bicycling&language=en-en&sensor=false"; $data = @file_get_contents($url); $obj = json_decode($data); $arr = (array)$obj; to array of values return distance between 2 locations. is kind of web interaction possible vsto? have googled high , low , nothing search giving me results work with. ergo, think missing something.

pointers - List of nodes pointing to parent C++ -

i storing custom data structures in list, each 1 points it's parent. here data structure struct block{ int someval; block * parent = 0; } i need fill list 'block's , each 1 needs point parent, initialise follows: block q; std::vector<block> something; // assume filled 4 blocks i init first object in list have parent point (easy way identify last element) something[0].parent = &something[0]; as setting others, logic: for(int = 1; < 3; i++){ something[i].parent = &q; q = something[i]; } now, looks should produce like: something[0].parent = #address of something[1].parent = #address of 0 something[2].parent = #address of 1 something[3].parent = #address of 2 but it's assiging memory location of something[0] any ideas why happening?

python - Detecting sprite object within a sprite group on collision -

i new pygame , working on distributed peer-peer multiplayer game. tried doing following not able figure out how. i have player class , enemy class. player , enemies part of different sprite groups. in 4 player game there 1 player object , 3 enemy objects, when player fires , use spritecollide method check collision enemy sprite group. want identify in specific enemy has been shot within spritegroup. quite not able figure out. possible ? seeing sounds enemy objects , player objects can same thing, maybe should have 1 common class both enemy , player . this called example creature class. based on if creature enemy or player can control using enemyai class or userinput class. as identifying hit, can add name variable within each of creature classes define upon declaring new creature . when evaluate hits, can have function return name of creature hit.

Python 3.3.4 and virtualenv creation on Windows: ImportError: No module named 'pip' -

i need virtualenv pyramid on xp . pip installs fine , virtualenv but when try create instance directory, virtualenv bombs. i uninstalled , re-installed virtualenv , keep getting same problem. any ideas? c:\>pip --version pip 1.5.4 c:\python334\lib\site-packages (python 3.3) c:\>virtualenv --version 1.11.4 c:\>virtualenv venv using base prefix 'c:\\python334' new python executable in venv\scripts\python.exe installing setuptools, pip... complete output command c:\venv\scripts\python.exe -c "import sys, pip; s ys...d\"] + sys.argv[1:]))" setuptools pip: traceback (most recent call last): file "<string>", line 1, in <module> importerror: no module named 'pip' ---------------------------------------- ...installing setuptools, pip...done. traceback (most recent call last): file "c:\python334\lib\runpy.py", line 160, in _run_module_as_main "__main__", fname, loader, pkg_name) f

java - How to list available containers in SWIFT using JCloud? -

can tell how list available containers in openstack swift using jcloud ? have used keystone authentication. any appreciated :) if using portable abstraction, can list containers blobstore.list . note differs blobstore.list(string) , lists blobs within container.

python - How to extract text and text coordinates from a pdf file? -

i want extract text boxes , text box coordinates pdf file. many other stackoverflow posts address various solutions try extract text in ordered fashion, took me quite while figure out how intermediate step of getting text , text locations. so once found it, thought worth posting here. given pdf file, output should like: 489, 41, "signature" 500, 52, "b" 630, 202, "a_g_i_r" newlines converted underscores in final output. minimal working solution found. from pdfminer.pdfparser import pdfparser pdfminer.pdfdocument import pdfdocument pdfminer.pdfpage import pdfpage pdfminer.pdfpage import pdftextextractionnotallowed pdfminer.pdfinterp import pdfresourcemanager pdfminer.pdfinterp import pdfpageinterpreter pdfminer.pdfdevice import pdfdevice pdfminer.layout import laparams pdfminer.converter import pdfpageaggregator import pdfminer # open pdf file. fp = open('/users/me/downloads/test.pdf', 'rb') # create pdf par

Simple Rails ActiveRecord stars count query? -

this simple question. how retrieve 'rateable_id's sum of stars count 'dimension': foundation in descending order? chain of queries use? in table rates: - !ruby/object:rate attributes: id: 11 rater_id: 1 rateable_id: 3 rateable_type: bboy stars: 5.0 dimension: foundation created_at: 2014-02-25 09:33:23.000000000 z updated_at: 2014-02-25 09:33:23.000000000 z - !ruby/object:rate attributes: id: 12 rater_id: 1 rateable_id: 3 rateable_type: bboy stars: 5.0 dimension: originality created_at: 2014-02-25 09:33:24.000000000 z updated_at: 2014-02-25 09:33:24.000000000 z - !ruby/object:rate attributes: id: 13 rater_id: 1 rateable_id: 3 rateable_type: bboy stars: 5.0 dimension: dynamics created_at: 2014-02-25 09:33:25.000000000 z updated_at: 2014-02-25 09:33:25.000000000 z - !ruby/object:rate attributes: id: 14 rater_id: 1 rateable_id: 3 rateable_type: bbo

How can you get the current caret position in terminal with Java? -

i've looked @ jline, lanterna, , others, i'm not seeing simple way find current caret position in terminal these tools. i've looked @ number of escape codes, tput, etc. but, i'm looking easiest way current column , row caret located java. maybe haven't found right call in these libraries... what's easiest way row , column of caret in terminal? i'm looking pure textual library can re-write buffer. i'm aware of ansi escape codes , how manipulate them produce effects i'm after. i'm trying make java prompt library in vain of inquirer.js node. has number of simple ways info user (lists, questions, split lists, etc). of text -- of without ui, , non-swing. don't want swing, want decent terminal ui experience. edit2 with http://docs.oracle.com/javase/7/docs/api/javax/swing/text/caret.html caret interface, can create caretlistener object in order find caret position. so have create new caretlistener responds gui, getdot() meth

ios - UIImage not retrieving From NSUserDefaults -

in application grab image picker , try display in separate view. in mainviewcontroller.m have -(void)imagepickercontroller:(uiimagepickercontroller*)picker didfinishpickingmediawithinfo:(nsdictionary*)info { [picker dismissviewcontrolleranimated:yes completion:^ { self.image = [info objectforkey:@"uiimagepickercontrolleroriginalimage"]; nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; [defaults setobject:uiimagepngrepresentation(self.image) forkey:@"imagekey"]; [defaults synchronize]; publishviewcontroller *publish = [self.storyboard instantiateviewcontrollerwithidentifier:@"publish"]; [self presentviewcontroller:publish animated:yes completion:nil]; }]; } i try retrieve image in publishviewcontroller.m - (void)viewdidload { [super viewdidload]; // additional setup after loading view. nsdata *imagedata = [[nsuserdefaults standarduserdefaults] objectforkey:@"imagekey"]; uiimage *userimage = [

css - text displayed outside of <div> when parent position is relative -

i have title bar <div> contains text. position of <div> working fine but weird reason text inside outside <div> follows in jsfiddle code. have tried can't find out why text there. may have floating <div> 's above or parent element (the <div> ) being set to: div#user_topics_box { position: relative; top: 134px; left: 0px; } still don't understand how affecting inner text. appreciated! edit: text supposed inside first black bar div above it. http://jsfiddle.net/ka6f5/1/show/ http://www.quirksmode.org/css/clearing.html you need clear floated containers preceding. #user_topics_box { clear: both; left: 0; position: relative; top: 134px; } and make floated containers contained in parent container #profile_area { overflow: hidden; }

algorithm - making use of neighbour finding and symmetry for runtime performance? -

suppose have set of 3d points {x[i], i=1,...,n} , , i have array a , each entry a[i] of array corresponds measurement of point x[i] . if 2 points x[i] , x[j] within fixed distance d each other, add constant f(x[i],x[j]) , computed function f , both of entries a[i] , a[j] in array. a direct way compute entries of array a (in pseudocode) for = 1,...,n a[i] = 0 = 1,...,n j = i,...,n if dist(x[i],x[j]) < d tmp = f(x[i],x[j]) a[i]+= tmp a[j]+= tmp if have function find_nb(x[i]) , takes point x[i] argument , returns set of points within fixed distance d point x[i] , including point x[i] itself, , number of them, wonder how function can improve run time performance (such time and/or space) of above algorithm? following way thought of: for = 1,...,n a[i] = 0 = 1,...,n (nbs, num) = find_nb(x[i]) j = 1,...,num a[i]+=f(x[i],x[nbs[j]]) but doesn't make use of symmetry between every 2 points

javascript - Bootstrap (v3.1.1) modal not displaying -

i've looked around @ various solutions can't seem working. i've used following code create modal: <div aria-hidden='true' aria-labelledby='newspeakerlabel' class='modal fade speaker-form' role='dialog' tabindex='-1'> <div class='modal-dialog'> <div class='modal content'> <div class='modal-header'> <button aria-hidden='true' class='close' data-dismiss='modal' type='button'>&times;</button> <h4 class='modal-title' id='newspeakerlabel'>new speaker</h4> </div> <div class='modal-body'> put form here </div> <div class='modal-footer'> <button class='btn btn-default' data-dismiss='modal' type='button'>close</button> <button class='btn btn-primary' type=&#

mongodb - Importing Backup Collections with mGo -

i have bson export mongodump , , have json export mongoexport what easiest way import mgo? mgo support inserting backed-up bson collection? or need use json export, unmarshal , insert() mgo? thing don't want have specify scheme in go file - want dump file database. what easiest way import mgo? easiest? shell out mongorestore go program. boom, done. does mgo support inserting backed-up bson collection? i don't see first-class support it. (you email author). should possible , may bit of work. should able use mgo bson layer load *.bson files , insert them db. you'll have parse *.metadata.json files indexes, etc. seems lot of work. (basically rewriting mongorestore .) or need use json export, unmarshal , insert() mgo? that slower, , you'd have test $date , $oid handled correctly, seems should work. might simpler write because don't have learn bson layer.

java - Random numbers without duplicate -

this question has answer here: java - generate random range of specific numbers without duplication of numbers - how to? 5 answers public class startorder { public static void main(string[] args) { int[] start = new int[45]; for(int i=0;i<start.length;i++) { start[i] = (int)(math.random()*45); } for(int i=0;i<start.length;i++) { system.out.println(start[i]); } } } i want make simple program prints random numbers between 1-45. problem though there's duplicate numbers among them, how can make print numbers between 1-45 without duplication. it's program generates random start number. fill list preferred numbers, shuffle it, example using build in library function below. list<integer> mynumbers = arrays.aslist(1,2,3,4, etc.); collections.shuffle(mynumbers); then iterate on list. btw, called random permutation.

How to deal with a git local folder within another? -

i have big git folder contains of programming studies. have clone remote git folder big folder, creating git working directory within one. i want them co-exist because ide use (rstudio) create project based on git, , want rstudio project contained within smaller folder only. is possible or cause trouble? in case, should clone small folder delete .git folder? git has feature setup called git submodule allows include external git repositories within single project. to use submodules save each of individual projects own git repository. in master project (your main programming studies git repository) include them using git submodule add <path-to-individual-project-repository> command. after add submodules don't forget git submodule update --init checkout files individual projects.

scheme - Convert lists into functions -

i have little noob question. have homework on genetic programming in scheme , first step finish given functions. i got point have execute randomly generated function possible parameters in range (using map). "function" list '(* (+ 1 x) (- x (* 2 3))) . how can execute given parameter? (for example x = 2). way, generated function has maximum of 1 parameter (it's x or none). thanks! here's solution: (define (execute expr) (lambda (x) (let recur ((expr expr)) (case expr ((x) x) ((+) +) ((-) -) ((*) *) ((/) /) (else (if (list? expr) (apply (recur (car expr)) (map recur (cdr expr))) expr)))))) example usage: > (define foo (execute '(* (+ 1 x) (- x (* 2 3))))) > (foo 42) => 1548

sql - RODBC loses time values of datetime when result set is large -

so very strange. rodbc seems drop time portion of datetime sql columns if result set large enough. (the queries running against sql server 2012 machine, and, yes, when run them on sql server side produce identical , proper results, regardless of how many rows returned.) for example, following works perfectly: myconn <- odbcconnect(dsnname, uid, pwd) results <- sqlquery(myconn, "select top 100 myid, mydatetimecolumn mytable order mydatetimecolumn desc") close(myconn) in r, following works expected: > results$mydatetimecolumn[3] [1] "2013-07-01 00:01:22 pdt" which valid posixct date time. however, when somewhere between 10,000 , 100,000 rows returned, time portion disappears: myconn <- odbcconnect(dsnname, uid, pwd) bigresults <- sqlquery(myconn, "select top 100000 myid, mydatetimecolumn mytable order mydatetimecolumn desc") close(myconn) (same code, larger number of rows returned; note : exact same row has lost time

google bigquery - Big query returned "Unexpected. Please try again." -

in big query select request python api, 500 error says "unexpected. please try again." i did same query on bigquery cloud console , worked expected on there. my job number job_bkcwpwlivdjma5zic0-mre__etu. i looked job, you're running select * on table produced in non-standard way (it internal google table made available outside researchers). table has data types aren't directly supported bigquery. recollection these tables use packed bytes represent ip addresses. these encoded strings, bigquery gets grumpy when strings aren't able encoded utf8. 1 solution avoid selecting fields if don't need them. this should fixed sometime within next week; should end not returning fields.

xml - XPath - Select LAST occurence of String -

i've got tree: <events> <properties> <property descriptor=100>1378314022</property> <property descriptor=200>abc1234</property> </properties> <properties> <property descriptor=100>1378314023</property> <property descriptor=200>abc1234</property> </properties> <properties> <property descriptor=100>1378314024</property> <property descriptor=200>abc1234</property> </properties> <properties> <property descriptor=100>1378314022</property> <property descriptor=200>123456</property> </properties> <properties> <property descriptor=100>1378314023</property> <property descriptor=200>123456</property> </properties> <properties> <property descriptor=100>1378314024</property> <property descriptor=200>123456</property> </proper

php - checking if there is valid data before implode -

i have array built dynamically, need check if empty before process (implode it) is there way isset or checking array index... i need know if not empty , array when empty keeps given me count of 1 edited: my array build code $( function() { $( "#btn4" ).click( function() { var cid = new array(); $( "input[name='cid[]']:checked" ).each( function() { cid.push( $( ).val() ); i send trow ajax $_post , if there checkbox selected every thing works fine, if empty implode error ... tryed check if empty $array , tryed count $array , nothing works... you may use: if(count($arr)) count() checks amount of items in array, therefore 0 elements evaluate false ;

sqlite - How to specify where clause with at least x values from nested select -

suppose have these tables: person id name -- ---- 1 dude 2 john 3 doe ...etc favourite_food personid food -------- ------ 1 apples 5 apples 5 oranges and want list of names of people @ least foods person 5 likes. below: select p.name person p left join favourite_food ff on ff.personid = p.id ff.food = (select food favourite_food personid = 5) , ff.personid <> 5; except have no idea how specify 'at least' part. have create temporary table or so? sql works sets, helps reformulate problem strictly in terms of set theory. "at least" reformulated way: if @ foods favourite foods of person 5, persons have same number of favourite foods person 5? select name person id in (select personid favourite_food food in (select food favourite_food personid = 5) group personid having count(food) = (select coun

python - How do you clean up redundant values in a list of lists -

say have list of list x=[[0,0,0,3,4],[8,8,9,2,8,2]] how make each sublist contain repeated number once: new list: xnew=[[0,3,4],[8,9,2]] you can use set that: new_x = [list(set(i)) in old_x] sets collection of unique elements , therefore create set of unique values when list of duplicate values cast set. can convert set list , desired result. example >>> old_x = [[0,0,0,3,4],[8,8,9,2,8,2]] >>> new_x = [list(set(i)) in old_x] >>> print new_x [[0,3,4],[8,9,2]]

hibernate - How to use same database transaction in separate thread with Play Framework 2.2 -

from play's documentation : because of way play 2.0 works, action code must fast possible (ie. non blocking). should return result if not yet able generate it? response promise of result! so shouldn't doing database calls directly inside of action. confuses me when @ plays jpa documentation : every jpa call must done in transaction so, enable jpa particular action, annotate @play.db.jpa.transactional. compose action method jpa action manages transaction you this leaves me little bit confused. if follow documentation, shouldn't block action thread database call. if action what's creating , managing database transaction, aren't losing transaction sending work actor, or somehow offloading work thread? mean, i'm new scala , play, don't see how transaction follow separate threads. have explanation, or way should doing this? i'm confused. you missing piece of puzzle, read under "highly synchronous" here: http:

java - Signing JAR to allow its classes to have internet access -

i have java application requires internet access since embeds web browser means of webview javafx component. if application not packaged in jar, executes without problems. however, when packaged in jar cannot access internet anymore (e.g., cannot load remote javascript files requires, such jquery). i tried fix signing jar with: jarsigner myjar myalias and command succeeds, although following warning: warning: signer certificate expire within 6 months. no -tsa or -tsacert provided , jar not timestamped. without timestamp, users may not able validate jar after signer certificate's expiration date (2014-07-08) or after future revocation date. however, application still not have internet access (the embedded browser still cannot load remote script files). supposed sign in other way ? maybe including certificate recognized certificate authority ? i have configured permissions in ~/.java.policy file follows: keystore "file:<userpath>/.keystore&

Google Maps - Identical values in all info windows -

this question has answer here: google maps js api v3 - simple multiple marker example 11 answers like many other people i'm finding identical values within info windows. alas, i've been using other posts in attempt troubleshoot. no luck. issue: each of infowindows shows same values. sigh. any appreciated. var map; function initialize() { var markers = []; var mapoptions = { zoom: 4, scrollwheel: false, streetviewcontrol: true, pancontrol: true, zoomcontrol: true, zoomcontroloptions: { style: google.maps.zoomcontrolstyle.large // position: google.maps.controlposition.left_center }, center: new google.maps.latlng(-25.898854, 134.091377) }; map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); setmarkers(map, beache