Posts

Showing posts from May, 2012

android - Best screen resolution page width 1200px on most devices on 2015 -

i have liquid flexible layout 3 columns, on left 200px , right 200px if page support infinite width set standard 2015 center column main content. 800px nobody uses question if 1000px old , uses 1300px or recoomend? i tested 1000px width , works fine on many cellphones , tablets (horizontal view) seems old notebooks , netbooks supports 1300px. what recoomend , screen resolution popular on year 2015 including old devices? i use 1200px (with padding goes 1180px), 1300px works fine, too. make sure website responsive, no 1 have problems.

dictionary - Scala - Futures and Eithers -

this thread gave me idea how structure code: scala-way handle conditions in for-comprehensions? the part in question: // first create json val resultfuture: future[either[failure, jsresult]] = { userres <- userdao.finduser(userid) user <- userres.withfailure(usernotfound).right authres <- userdao.authenticate(user) auth <- authres.withfailure(notauthenticated).right goodres <- gooddao.findgood(goodid) <- goodres.withfailure(goodnotfound).right checkedgood <- checkgood(user, good).right } yield renderjson(map("success" -> true))) this lines not understand: user <- userres.withfailure(usernotfound).right authres <- userdao.authenticate(user) the userres.withfailure(usernotfound).right mapped userdao.authenticate(user) . create new either future on right, correct? how can val resultfuture: future[either[failure, jsresult]] be of type. think instead of jsresult there should future. can explain me? edit

php - Require Facebook like to connect to wireless network -

i have received request friend today. owns coffee shop , there free wifi access point. wants require visitors coffee shop's facebook page connect network. don't know how can this. router tp-link tl-wr940n. my idea: install dd-wrt redirect custom login page on custom login page, use facebook api facebook login after user logs in, check if he/she liked page if not, redirect them shop's facebook page the bad thing can't redirect them after liking page. is there better solution?

mysql - Using the division operator in a query that gets data from 3 tables -

i having trouble writing query gets information 3 different tables. right have query runs... not getting right result. talking peers found out 1 way query use division operator confused on how it. show query definition, tables, , query wrote , maybe here can me fix query or explain me how utilize division operator! query definition: find users utilize every protein in jobs. find users have used every protein once. within 1 job or 100 jobs. tables: create table job(uid integer,job_id integer auto_increment,input varchar(500), foreign key(uid) references user(uid) on delete cascade, primary key(job_id))engine = innodb; create table protein_info(pid integer,sequence varchar(200), foreign key(pid) references protein(pid),primary key(pid))engine = innodb; create table protein(pid integer,name varchar(50),primary key(pid)) engine=innodb; insert job(uid, job_id, input) values(1, 1, abc),(2, 2, bce), (1, 3, aeo),(3, 4, pqo),(1, 5, bce), (1, 6, pqo) insert protein_info(pid, seq

postgresql - Update field in multiple tables by foreign key constraint? -

asume have schema this: create table "user" ( id bigserial primary key, sid varchar(32) not null, active boolean not null default true, login varchar(32) not null, ); create table user_authority_relation ( id bigserial primary key, user_id int8 not null, authority_id int8 not null, constraint user_fk foreign key (user_id) references "user" (id) on delete cascade, constraint authority_fk foreign key (authority_id) references "authority" (id) on delete cascade, unique (user_id, authority_id) ); create table note ( id bigserial primary key, content text not null, sender_id int8 not null, sent_date timestamp without time zone not null, important boolean not null, type varchar(16) not null, constraint user_fk foreign key (sender_id) references "user" (id) on delete cascade deferrable immediate ); now, must delete user x db, instead of delete related objects want replace id new user y. e

Java - Quick modulus operation -

i want this: public int myfunc(int n) { for(int i=0; i<=n; i++) { if(n % == 0) return i; } return 0; } with small numbers, works fine, on greater ones not. how can accomplish same thing, without % operator? thank you. sadly cannot quickly. the fastest way - int being used - run through list of known primes checking divisibility. here list of first 1000 primes. read them in , try each in turn sqrt(n) . something this: // 10,000 primes - http://primes.utm.edu/lists/small/10000.txt private static final arraylist<integer> someprimes = new arraylist<>(); private static final string primesfilename = "10000primes.txt"; //private static final string primesfilename = "100008primes.txt"; static { try (inputstream in = primes.class.getresourceasstream(primesfilename); inputstreamreader isr = new inputstreamreader(in); bufferedreader br = new bufferedreader(isr)) { (st

iframe - How to detect if Google Analytics is loaded and able to track custom Events -

we're having issues when we're loading iframe video player sends playback events google universal analytics (analytics.js) loaded inside iframe (on domain). ga tracker not being loaded on ios devices , because of that, no event tracking being sent ga. on android , other devices including desktop works fine, not on ios unless changed third-party cookies setting comes default on ios safari. i did test using cookie-less method google analytics ( https://github.com/foture/cookieless-google-analytics ) , way ios devices able correctly send track events ga. however, want use method fallback when regular ga method don't work, because userid created via fingerprint method not unique on mobile devices. so need way detect when regular ga method able track events , if not able, either because tracker not loaded or cookies disabled, use cookie-less method load ga , track events. thanks! you try using (seemingly) undocumented property on ga object: ga.loaded . th

javascript - Multiple Iteration in for-loop using jQuery html() instead of document.write -

i have 3 set of arrays got looping , sorting json data. let's say, arr1 , arr2 , arr3 . want output arrays combined html codes 5 times. far, have code: var max=5; (var b = 0;b < max;b++) { var conel = $('#container'); var newconel = conel.html(); newconel = '<ul>'; var newprop = '<li><span><a href="'+arr1[b]+'">'+arr2[b]+'</a><span>'+arr3[b]+'</span></span></li>'; newconel += newprop + '</ul>'; return conel.html(newconel); } however, outputs 1 result. result: <div> <span> <a href="#link-to-result-1">result-1-title</a> <span>view-count-1</span> </span> </div> while, want have 5 output. desired result is: <div> <span> <a href="#link-to-result-1">result-1-title</a> <span>view-count-1</span> &l

javascript - Make game/site fit on screen without scrolling? -

i have created erase-a-man game , when view on mobile device main point. there scrolling see rest of letters, trying make page fit phone screen sizes there no need scroll or down see whole game. grateful. html <div id="home" data-role="page"> <p> <p id="warning">javascript must enabled play game.</p> <div role="main" class="ui-content"> <p> <div id="help"></div> <div id="helptext"> <h2>how play</h2> <div id="close"></div> <p>hangman word-guessing game. click or tap new game display letters of alphabet , row of dashes indicating number of letters guessed. click or tap letter. if it's in word, replaces dash(es). each wrong guess results in stroke being added gallows , victim. role guess word correctly before victim meets grisly fate.</p> </div> </p> </d

symfony - Twig: Translate DateFormat-> Day -

i have in twig-template {{ returndate|date("l, d.m.y") }} the ouput friday, 08.05.2015 . possible translate dayname -> "l" ? {{ returndate|date("l, d.m.y")|trans }} i had same problem minutes ago! pushed simple, quick & dirty solution: {{ returndate | date("l") | trans }}, {{ returndate | date("d.m.y") }}

How to implement Dijkstra's Algorithm to find the shortest path in Java -

i absolutely confused on do. i'm trying code off of pseudo code wikipedia has on dijkstra's priority queues, i'm having tough time making adjustments fit need find. (incomplete) code far, , appreciated. public int dodijkstras (string startvertexname, string endvertexname, arraylist< string > shortestpath) { priorityqueue<qentry> q = new priorityqueue<qentry>(); int cost = 0; int newcost; qentry pred = null; (string s : this.getvertices()) { if (!s.equals(startvertexname)) { cost = integer.max_value; pred = null; } q.add(new qentry(s, cost, pred, adjacencymap.get(s))); } while (!q.isempty()) { qentry curr = getmin(q); (string s : curr.adj.keyset()) { newcost = curr.cost + this.getcost(curr.name, s); qentry v = this.getvert(q, s); if (newcost < v.cost) {

c++ - BFS traverses graph node twice -

i have trouble finding bug in code of mine node in graph appears twice.i have used vector storing relationship between edges. highly appreciated. #include<bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n>>m; vector<int> v[n+1]; (int = 0; < m; ++i) { int a,b; cin>>a>>b; v[a].push_back(b); v[b].push_back(a); } std::queue<int>q ; q.push(1); cout<<"and traversal is:\n"; bool visited[n+1]={false}; for(;!q.empty();){ int curr=q.front(); q.pop(); cout<<curr<<endl; for(int i=0;i<v[curr].size();++i){ if(!visited[v[curr][i]]){ q.push(v[curr][i]); visited[curr]=true; } } } } the input checked against: 5 5 1 3 3 2 2 4 3 5 5 4 output: and traversal is: 1 3 2 5 4 4 you need distinguish 3 states node can in: unpr

matlab - Use more points to define imroi object -

Image
in short: wondering if possible, when using roi base classes ( imroi actually) such impoly , imfreehand , others increase number of points (i.e. increase sensitivity) generated getposition method. sample code: consider following code, in i: 1) read , display image 2) call imfreehand draw closed region of interest. 3) call getposition nx2 array in coordinates defining freehand object draw stored. 4) call scatter see actual coordinates recorded. clear clc close %// read , display image = imread('coins.png'); imshow(a) %// set imroi object hroi = imfreehand(gca,'closed',1); %// position nx2 array roiposition = getposition(hroi); %// display points retrieved getposition method. hold on scatter(roiposition(:,1),roiposition(:,2),20,'r','filled') after zooming on roi drawn, this: which 1 can see lack couple points describe object. to put in other words, possible obtain nx2 array getposition method n larger default (whose

Android Studio 1.1.0 doesn't see the tablet attached; Windows 7 can't find driver -

Image
edit--problem solved! see end. i turned on developer options tapping settings > general > device , tapping build number 7 times. turned on usb debugging via settings > general > developer options , checking usb debugging . when first connected, tablet says connected media device not usb debugging connected . doesn't see , can't connect it. device manager shows this: the "portable device" tablet. it's shown in "other devices". when have tried "update driver" cdc serial or samsung_android, i've been told "windows can't find driver software". cdc serial, told: i went http://www.samsung.com/us/support/owners/product/sm-t530nzwaxar , downloaded driver. installed. went , lists device long hex number , says "unauthorized". the adb log has many identical messages: propertyfetcher: adbcommandrejectedexception getting properties device e4e2a688077e28d0: device unauthorized. please check

Style Text Android Wear Card Fragment -

for android wear application have few card fragments in fragmentgridpageradapter. font size title , text in cards small. is possible style title , text in card fragment using different font types , font sizes? if so, how go doing this? cheers. you can change content of card fragment , change textsize in layout of fragment : <android.support.wearable.view.cardframe android:layout_height="wrap_content" android:layout_width="fill_parent"> <linearlayout android:layout_height="wrap_content" android:layout_width="match_parent" android:orientation="vertical" android:paddingleft="5dp"> <textview android:fontfamily="sans-serif-light" android:layout_height="wrap_content" android:layout_width="match_parent" android:text="@string/custom_card" android:tex

grails - GORM many-to-many on same domain -

i want create relation many-to-many between same entity. class device { static hasmany = [devices: device] } but leaves me one-to-many. how can accomplish this? know there quite few examples of many-to-many between 2 domains or many-to-many when there link 2 sets of same domain in different one, can't find such example nowhere. you create sort of hacked many many list of devices class device { static hasmany = [devicesownedby: device, devicesowned: device] } here have device - devices 1..* , device - devicesowned 1..* i doubt solution looking for, might suffice till answer comes along.

Pushing a new file to a git branch using Jenkins -

we migrating our code base svn gitlab , in preparation attempting test basic functionality between git , jenkins. 1 of areas having issue pushing new file git. the console log appears though push worked expected actual git repo has no record of push happening. here shown in console: cloning remote git repository remote: counting objects remote: compressing objects receiving objects resolving deltas updating references checking out revision a0523f53acf74c5d4fd464d8b1126102c00fd9ee (origin/master) [test-post-to-git2] $ cmd /c call >c:\users\admin\appdata\local\temp\hudson741863400083270764.bat [test-post-to-git2] $ cmd /c call >c:\users\admin\appdata\local\temp\hudson7082713428543839601.bat f:\jenkins\workspace\test-post-to-git2>git add . f:\jenkins\workspace\test-post-to-git2>git commit -am "adding gittest.txt" [localmaster ac6b719] adding gittest.txt 2 files changed, 513 insertions(+), 512 deletions(-) c

split list two part in python using dictionary -

i want split list this [{'age': '23', 'name': 'john'}, {'age': '43', 'name': 'apple'}, {'age': '13', 'name': 'alice'}] this code temp_list=["john","apple","alice","23","43","13"] temp_dict={'name':'','age':''} final_list=[] temp in temp_list: temp_dict['name']=temp temp_dict['age']=temp final_list.append(temp_dict) temp_dict={'name':'','age':''} print final_list how can do? you can use following dict comprehension: final_list = dict(zip(temp_list[:3], temp_list[3:])) example: >>> temp_list=["john","apple","alice","23","43","13"] >>> final_list = dict(zip(temp_list[:3], temp_list[3:])) >>> final_list {'john': '23&#

Google Books API Cover images over HTTPS fails due to certificate error -

Image
starting yesterday requests cover images via https began failing err_insecure_response. for example: https://www.googleapis.com/books/v1/volumes/zarox10_usmc when trying access https version of thumbnail: https://bks1.books.google.com/books/content?id=zarox10_usmc&printsec=frontcover&img=1&zoom=1&edge=curl&imgtk=aflre72edppkxv6qhjzfmvf2sug_dizxnci02yjvanqre6xpdal1gdx5m-h_2nqbzj2zj_krgtsw245c0-gwif85xui5rj2-v07quql9ker6apideji27w9rvadacbwacqxsqpy-1rt9&source=gbs_api in chrome returns response of net::err_cert_common_name_invalid safari , firefox unable load resource due certificate error. remove sub-sub-domain, or encryption: this encrypted version of image @ https://books.google.com , and this unencrypted version @ http://bk1.books.google.com their certificate covers wildcard .google.com not wildcard.wildcard .google.com. speculating i'd guess bks1 1 of pool of servers behind books .

jbpm process exception Unable to lookup JNDI name -

i playing around jbpm 6.1 tool , after modifying example provided eclipse jbpm maven project tool i'm keep getting exception: javax.persistence.persistenceexception: [persistenceunit: org.jbpm.persistence.jpa] unable build entitymanagerfactory @ org.hibernate.ejb.ejb3configuration.buildentitymanagerfactory(ejb3configuration.java:924) @ org.hibernate.ejb.ejb3configuration.buildentitymanagerfactory(ejb3configuration.java:899) @ org.hibernate.ejb.hibernatepersistence.createentitymanagerfactory(hibernatepersistence.java:59) @ javax.persistence.persistence.createentitymanagerfactory(persistence.java:63) @ javax.persistence.persistence.createentitymanagerfactory(persistence.java:47) @ com.sample.initialclasskeysession.createruntimemanager(initialclasskeysession.java:62) @ com.sample.initialclasskeysession.<init>(initialclasskeysession.java:47) @ com.sample.initialclasskeysession.startprocessinit(initialclasskeysession.java:35) @ com.sample.

list - get element by index vs get with pop() Python -

f.e. have list 1 element i = ['x'] i - list 1 element what way more pythonic or performance: element = i[0] or element = i.pop() we dont care list, if "cut" element pop - no problem us i[0] more performant, since has fewer operations carry out. if there's no reason pop list, why it? that's confusing next programmer looking @ code. use i[0] .

vb.net - I want to know how to add items to an arraylist -

here code:- if firstnametext.text = "" messagebox.show("please enter first name please") end if if surnametext.text = "" messagebox.show("please enter surname please") end if if (not rb_male.checked) andalso (not rb_female.checked) messagebox.show("please select gender") end if if combobox1.selectedvalue = false messagebox.show("please select year group") end if if textstudentid.text = "" messagebox.show("please select generate button give unique student id") end if "in section want add submitted items arraylist user's name pops in list box" try catch ex exception end try that's bit of code have written , have looked everywhere answer submit items arraylist. " " area i'm planning submit items arraylist. or link guide do. first, make class student information cl

android - Don't know why the app is crashing -

i have written code, keeps on crashing, don't know point onwards. here code: public class mainactivity extends activity { int windowwidth; int screencenter; int x_cord, y_cord, x, y; int likes = 0; relativelayout parentview; float alphavalue = 0; private context m_context; @suppresswarnings("deprecation") @suppresslint("newapi") @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); setcontentview(r.layout.mainlayout); m_context = mainactivity.this; parentview = (relativelayout) findviewbyid(r.id.layoutview); windowwidth = getwindowmanager().getdefaultdisplay().getwidth(); screencenter = windowwidth / 2; int[] myimagelist = new int[] { r.drawable.cats, r.drawable.baby1, r.drawable.sachin, r.drawable.cats, r.drawable.puppy }; (int = 0; &l

javascript - How would I test window prompts and confirms with Karma / Jasmine? -

i'm pretty new tdd , i've been doing programming prompts reddit learn it. 1 acronym generator asks string converted, displays it, , asks if user wants generate another. my trouble don't know how write tests fill in prompt , hit ok button. select ok or cancel button when asked again. (function(ns, undefined) { ns.generateacronym = function() { var s = window.prompt("enter words converted acronym."); var matches = s.match(/\b(\w)/g); var acronym = matches.join("").touppercase(); if(window.confirm("your acronym is: "+acronym+". generate another?")) { ns.generateacronym(); } }; })(window.pprompts = window.pprompts || {}); pprompts.generateacronym(); alright - think figured out. if has better methods, i'd love see/read them :) i realize have put of 1 it block, seeing executed 2 of 2 success on executed 1 of 1 success . describe('acron

list - Python function not working - Tkinter -

my function isn't giving me right output, , doesn't want work. keep getting error: typeerror: list indices must integers, not str this code: def showshop(level = level, cash = cash): top = tkinter.tk() shop = ["$100 & level 2 - shotgun", "$250 & level 3 - 5 grenades", "$500 & level 5 - rocket launcher"] buttons = [] in shop: temp = shop[i] temp = tkinter.button(top, height=10, width=100, text = temp, command = shopping(i)) temp.pack() buttons.append(temp) top.mainloop() i want display in shop list based on button is... remove temp = shop[i] code for in shop: temp = tkinter.button(top, height=10, width=100, text = temp, command = shopping(i)) temp.pack() buttons.append(temp) the for loop iterates on elements in list , not indices!. python docs make more clear the statement in python differs bit may used in c or pas

c# - AlphaBlending width DirectX and SharpDX giving strange results -

Image
i've been trying alphablending working dx9 + sharpdx + wpf combination, can't correct results out of it! here's how 2 triangles looks like, first 1 being opague gray, , other being same gray, alpha of 0.5. the problem reason half transparent gray added destination gray, understanding should calculated (source * sourcefactor) + (dest * destfactor), should (0.5 * 0.5) + (0.5 * (1 - 0.5)) = 0.5, isn't. the interesting parts of code: device9.setrenderstate(d3d9.renderstate.alphablendenable, true); device9.setrenderstate(d3d9.renderstate.sourceblend, d3d9.blend.sourcealpha); device9.setrenderstate(d3d9.renderstate.destinationblend, d3d9.blend.inversesourcealpha); device9.setrenderstate(d3d9.renderstate.blendoperation, d3d9.blendoperation.add); and have hlsl shader, takes position , color vertexes, 1 constant alpha value, pixel shader looks this: float4 pixelshaderfunction(vertexshaderoutput input) : color0 { return float4(input.color[0], input.color[1],

java - Difference between ${"id"} and #{"id"} for getting the object reference? -

what difference between these 2 selectors: $("id") , #('id') getting object reference in mybatis mapper xml. have seen examples like <select id="selectusers" resulttype="map"> select id, username, hashedpassword some_table id = #{id} </select> as this <select id="selectuser" parametertype="user" resulttype="user"> select id, username, hashedpassword some_table id = ${user.id} </select> #{id} - mybatis generate preparedstatement ${id} - mybatis directly inject value in statement string see string_substitution in mybatis documentation.

php - As in Kohana 3.3 sort the list of users, the number of orders? -

suppose have 2 orm model: class model_user extends orm { protected $_has_many = array( 'orders' => array( 'model' => 'order', 'foreign_key' => 'order_id', ), ); } class model_order extends orm { protected $_belongs_to = array( 'author' => array( 'model' => 'user', 'foreign_key' => 'author_id', ), ); } orm::factory('user')->find_all(); //displays list of users as can see list of users, sorted number of orders? possible? you can sort records using order_by orm::factory('user')->order_by('order_id', 'desc')->find_all(); //displays list of users

jquery - Submit form details to another site via URL -

i have little "track parcel" widget on site. takes simple code, or tracking number. i wish pass site, tracking number placed in url. example: http://www.site.co.uk/en/express/tracking.html?awb=1234&brand=site i wish value placed in form field, , build url using code (where 1234 in example above). i have created form, , function should value field. should open new window going url. form html : <h2>track parcel</h2> <form action="trackparcel()" method="get"> <input type="text" class="tracking" name="tracking" placeholder="enter waybill number" /> <input type="submit" /> </form> function : jquery(document).ready(function($) { function trackparcel(){ event.preventdefault(); console.log('here'); var tracking = $('.tracking').find('input[name="tracking"]').val();

jQuery dialog adding many css-classes on open then not removing them on close -

my jquery dialogues work fine except the following appended every time dialog opened . js flexbox flexboxlegacy canvas canvastext webgl no-touch geolocation postmessage websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths they not removed when close. when open dialog again it'll re-add these classes. html element's class attribute become half page pretty quickly. dialog setup : $(dialogselector).dialog({ modal: true, title: "current schedule", width: 450, height: 500 }); full function: function viewscheduledialog(dialogselector, href, id) { $.ajax({ url: href, type: "get", dat

javascript - Extjs itemId in class definition -

is bad practice have itemid configuration on class definition (instead of instantiation)? is there official documentation backs or matter of opinion? or maybe there logic i'm missing makes evident bad practice. ext.define('someapp.view.somefolder.myspecialcomponent',{ extend: 'ext.panel.panel', itemid: 'specialcomponent' // ... }); because understand if there more 1 instance , use itemid selector both instances. let's know won't have more 1 instance @ time , let's instantiation can occur in 3 different places, don't want add itemid's in 3 different places , don't want itemid's different. so there official posture using itemid configuration @ class definition? from docs of ext.abstractcomponent.itemid : an itemid can used alternative way reference component when no object reference available. instead of using id ext.getcmp, use itemid ext.container.container.getcomponent retrieve itemid's

PHP Apache print is suspended in server side if client just opens connection -

in server side have script file test_print.php: <?php ini_set("display_errors", 1); file_put_contents("/home/tmp/debug.txt", "test\n", file_append); $s_long_string = ""; ($i = 0; $i < 10000; $i++) { $s_long_string .= "abcrc{$i}"; } echo $s_long_string; echo $s_long_string; echo $s_long_string; echo $s_long_string; echo $s_long_string; echo $s_long_string; echo $s_long_string; echo $s_long_string; file_put_contents("/home/tmp/debug.txt", "test2\n", file_append); ?> and have client script test.php: <?php $fh = fopen('http://localhost/test_print.php', 'r'); ?> if execute script test.php, can see second line in file /home/tmp/debug.txt not added. php code suspended after first print , waits client request content. if content requested, php executed, if not php file not executed. problem that, if in client script added sleep function, php file not executed , waits client a

javascript - youtube iframe api events not firing on IE -

java script code : var tag = document.createelement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstscripttag = document.getelementsbytagname('script')[0]; firstscripttag.parentnode.insertbefore(tag, firstscripttag); var player; window.onyoutubeiframeapiready=function() { player = new yt.player('video', { events: { 'onready': onplayerready, 'onstatechange': onplayerstatechange } }); } function onplayerready(event) { alert("onplayerready"); } function onplayerstatechange(event) { alert("statechanged"); } and iframe in html wrote <iframe id="video" width="560" height="315" src="https://www.youtube.com/embed/che_onjaoau?enablejsapi=1&autohide=1&autoplay=1&controls=0&showinfo=0&playerapiid=ytplayer" frameborder="

windows store apps - Creating a 2D image gallery (Horizontal + Vertical) in C# -

i working on project fashion store app windows phone. catalogue need create image gallery in if scroll vertically see images related same product, , if scroll sideways see next/previous product. i have started off creating little concept gallery 3x3 images. 1 column planes, second tanks , third warships. used 1 horizontal flipview has 3 vertical flipviews it's items. here xaml code: <grid background="{themeresource applicationpagebackgroundthemebrush}"> <flipview x:name="flipbase"> <flipview x:name="a"> <flipview.itemspanel> <itemspaneltemplate> <virtualizingstackpanel orientation="vertical" /> </itemspaneltemplate> </flipview.itemspanel> </flipview> <flipview x:name="b"> <flipview.itemspanel> <itemspaneltemplate>

Launch FreeBSD 8.4 (and newer) under qemu/kvm -

Image
i'm trying launch freebsd releases since 6.0 , never in virtual machines, using qemu-2.0.0+dfsg-2ubuntu1.10 (qemu-kvm) , virt-manager-1:1.1.0-1~getdeb3 . all releases under 8.4 (and 9.0) runs fine same settings of vm, can't launch 8.4+ (9.1+): go loop after seconds after boot starts. error message during boot loop is: fatal trap 12: page fault while in kernel mode ... fault code = supervisor read data, page not present i know, 8.4 brings lot of virtio stuff in freebsd kernel. theoretically should make working vm easier, can't figure out problem environment. how make freebsd 8.4 working qemu-kvm? the reason in model of virtualized cpu. changing processor model "hypervisor default" "kvm64" in virt-manager gui solves problem.

php - Make search output error if no results are found -

i trying make error message appear if when user searches, no results found; having issue getting error message display. here code: <!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>php test file</title> <link href="phptestcss.css" rel="stylesheet" type="text/css" /> <link href="lightbox-style/lightbox.css" rel="stylesheet" type="text/css" media="screen"/> <script src="js/prototype.js" type="text/javascript"></script> <script src="js/scriptaculous.js?load=effects,builder" type="text/javascript"></script> <script src="js

uri - E-Commerce REST API for categories -

in e-commerce project, building set of rest apis list categories , products catalog management system. category can have sub-categories , product can belong category or stand itself. - root_category - sub_category - product1 - product2 - product3 here in example, root_category contains sub_category & product2 . subcategory contains product1 . product3 doesn't belong category. here possible use cases: list products in system. /products get product details id. /products/{id} search products id, name or description (need query 1 of these criteria) /products?searchtem={searchterm}&q=[byid|byname|bydescription] list categories in system. /categories 5(a). list sub categories belonging particular category. /categories/{id}/categories 5(b). list root level categories. (eg. root_category ). /categories/@root/categories 6(a). list products belonging category. /categories/{id}/products 6(b). list products don't belo

excel - Matrix with boolean values from a list of paired observations -

Image
in below spreadsheet, cell values represent id person. person in column likes person in column b, may not mutual. so, in first row data, person 1 likes 2. in second row data person 1 likes 3. a b 1 2 1 3 2 1 2 4 3 4 4 1 i'm looking way have 4 x 4 matrix entry of 1 in (i,j) indicate person likes person j , entry of 0 indicate don't. example above should after performing task: 1 2 3 4 1 0 1 1 0 2 1 0 0 1 3 0 0 0 1 4 1 0 0 0 so, reading first row of matrix interpret this: person 1 not person 1 (cell value = 0), person 1 likes person 2 (cell value = 1), person 1 likes person 3 (cell value =1), person 1 not person 4 (cell value = 0) note order of pairing matter [4 2] not equal [2 4] . how done? assuming existing data in a1:b6 , in a10 enter: =countifs($a$1:$a$6, row()-9,$b$1:$b$6, column()) this return 1 or 0 depending on whether person 1 likes person 1 . don't 0. uses row()-9 return 1 , column() retur

linq to sql - SQL Join Query taking long to complete -

Image
i working on project require me join 4 tables. have written code it's taking forever finish. please help. ohhh have 121 000 entries in db portfoliocollectiondatacontext context = null; context = datacontext; var logins = bkg in context.enquirybookings bkg.paid == true log in context.logins log.loginid == bkg.loginid enq in context.enquiries enq.enquiryid == bkg.enquiryid estb in context.establishments enq.establishmentid == estb.establishmentid select new { log.loginid, log.firstname, log.lastname, log.countryofresidence, log.emailaddress, log.telephonenumber, bkg.totalprice, es