Posts

Showing posts from May, 2011

object - php pass array to function as separate variables -

i need know how pass array function separate variables, instance, function myfunction($var, $othervar) { } $myarray = array('key'=>'val', 'data'=>'pair'); here running problems, following doesn't seem work: $return = myfunction(extract($myarray)); it should, if understand correctly, same as $return = myfunction($key, $data); where $key='val' , $data='pair' can please explain me. if understanding question right try this $return = myfunction($myarray["key"],$myarray["data"]); here passing associative array arguments.

Java - creating text adventure with no objects at all, -

this first time here, new programming, have been learning java 2 weeks , know basics, decided test knowledge doing simple text adventure game without using objects haven't got grip of yet. keep printing story , describing situation, , accepting player choices go on. having problem code don't know how repeat question if user entered invalid choice, tried couple of ways program either ends or gives me infinite loop, need ,please. here code: import java.util.scanner; class the_crime { public static void main(string[] args) { scanner input = new scanner(system.in); system.out.println("welcome stranger, please enter name"); string name = input.nextline(); system.out.println("welcome" + name); street street = new street(); system.out.println("you in street dead body on floor drowned in blood \n there building right ahead of you\n do?"); string choice = input.nextline(); ...

c - How can a single printf statement changes value in an array? -

the following program prints prime numbers between 1 , 10. #include <stdio.h> int* prime(int x,int y,int* range); void main() { int *x,s=10; int i=0; x=prime(1,10,&s); for(i=0;i<s;i++) { printf("%d\n",x[i]); } } int* prime(int x,int y,int *range){ int num[100],i,j,flag,inc=0; for(i=x;i<=y;i++) { flag=1; for(j=2;j<=(i/2);j++) { if(i%j == 0) flag=-1; } if(flag==1) { num[inc]=i; inc++; } } *range=inc; //printf("$$%d$$",*range); return num; } the output 1 2 3 5 0 in above case, if remove the comment in printf statement in prime function , give normal printf statement output 1 2 3 5 7 how possible?? what's bug here?? the compiler used gcc compiler in linux platform. your prime() method returns local variable num sitting on stack, it's not in sco...

html - I am having problems with CSS getting ads to line up -

i building website , have 3 ads towards bottom of page. appear on there own line. have tried creating floating div removing divs. can't seem figure out part of css isn't allowing these boxes straight across page. here code 3 boxes: <div class="wrapper margin-bot1"> <div class="bg-3"> <div class="indent"> <div class="wrapper margin-bot"> <img src="http://www.webstertoolbox.com/media/wysiwyg/images/page1_img1.png" alt="" /> <img src="http://www.webstertoolbox.com/media/wysiwyg/images/logo_archilume.png" alt="" width="150" height="41" /> </div> <ul class="ul-1"> <li><a href="morearchi.html">made in usa </a></li> <li><a href="morearchi.html">expert domes...

javascript - JQuery click function not working after removing and adding back elements -

this click function $('.cal table tbody td').on('click', function () { if($(this).hasclass('available')) { alert('asd'); } }); the problem having after have switched next or previous month, clicking function on calendar not work. for example in jsfiddle, if u move previous month , move current month , click function, wouldn't work anymore. edit: i'm using external library called date.js, check out jsfiddle clearer idea of going on. edit 2: updated jsfiddle link jsfiddle use this $(document).on('click','.cal table tbody td', function () { if ($(this).hasclass('available')) { alert('asd'); } }); instead of this $('.cal table tbody td').on('click', function () { if ($(this).hasclass('available')) { alert('asd'); } }); former correct replacement delegate

knockout.js - Knockout.Mapping - how to unmap when I've used a custom mapping? -

i use knockout.mapping plugin not have moment object instead of crappy date: var mappedpeople = ko.mapping.fromjs(people, { birthdate: { create: function(op) { return ko.observable( moment( new date(op.data) ) ); } } }); cool. now, after making modifications want return entire array regular js. sounds job ko.mapping.tojs ! but how go date? tojs seems take options object can't seem find option helps this. update : i'm aware in specific scenario of using moment.js there ways around issue coercing string , re-wrapping, underlying question how provide custom "unmapping" functions plugin. update 2 : here jsbin demonstrating issue: http://jsbin.com/uzesag/1/ i know not strictly speaking answering question of how customise unmapping itself, find useful way of handling type of situation wrap original data in observables, add computed observables (sub-observables) observables themselves. best illustrated example ....

routing - Unable to create posts in rails forum on the topics page -

i new rails , trying create forum. forum has many topics, topics belong forum , have many microposts, , microposts belong both topics , users. however, no matter try, posts not created. when try post, routing error "no route matches [get] "/topics"" my routes.rb file: resources :users resources :sessions, only: [:new, :create, :destroy] resources :microposts, only: [:create, :destroy] resources :forums, only: [:index, :show] resources :topics, only: [:show] _micropost_form.html.erb <%= form_for(@micropost) |f| %> <%= render 'shared/error_messages', object: f.object %> <div class="field"> <%= f.hidden_field :topic_id, value: @topic.id %> <%= f.hidden_field :user_id, value: current_user.id %> <%= f.text_field :summary, placeholder: "one-line summary..." %> <%= f.text_area :content, placeholder: "compose new post..." %> </div> <%= f.submit "post...

php - Zend Framework2 form error messages -

here code below, create login form class loginform extends form { public function __construct($name = null) { parent::__construct('login'); $this->setattribute('method', 'post'); $this->add(array('name'=>'uname','attributes'=>array('type'=>'text',), 'options'=>array('label'=>'username'), )); $this->add(array('name'=>'pword','attributes'=>array('type'=>'password',), 'options'=>array('label'=>'password'), )); $this->add(array('name'=>'submit','attribute'=>array('type'=>'submit', 'value' => 'go', 'class...

model - Populating a grid with json webservice extjs -

i have web service returns json. json this: aaa( { "data": { "error":0, "totalproperty":3, "groups": [ { "users": [ { "email":"natalia.busto@geograma.com", "name":"natalia", "surname":"busto jimenez", "rol":"user" } ], "description":"grupo por defecto del dominio demo", "name":"default", "numusers": 1 }, ...

sql - The sum of certain records in one table based on records of 3 fields -

have had , maybe asking wrong way can't find related question want. i have table has 4 fields, id record , cost type, supplement type , amount. need able add amount field of 2 of cost types 1 of supplement types 1 of id. pcm_id cost_type supplement_type amount ----------------------------------------------------- 2238 agent ss 85.785 2238 dbcost ss 77.9891 2238 dbcost_tax ss 7.7989 2238 dbsell ss 85.785 2238 dbsell_tax ss 8.5785 2238 pccom_tax ss 0 2238 pcmup_tax ss 0 2238 retail ss 85.785 so went add dbcost , dbcost_tax ss supplement. i don't know how query give me value each pcm_id above. my sql skills limited , self taught here have far. select sum (pcs.amount) dbo.pcs join dbo.pcm on pcm.pcm_id = pcs.pcm_id pcs.pcm_id = pcm...

requirejs - Configuring dojo loader paths -

i'm having trouble setting dojo . defined in dojo config seems correctly load using localhost:8080/scripts/foo.js path. if try load module without this, say: require(['foo'], function (_foo) { }); then client fails request, attempted path being localhost:8080/foo.js . wrong. what need change? // configuration dojo amd module loader dojoconfig = { baseurl: "/scripts", packages: [{ name: 'esri', location: 'esri' }, { name: 'dojo', location: 'dojo/dojo' }, { name: 'dojox', location: 'dojo/dojox' }, { name: 'dijit', location: 'dojo/dijit' }, { name: 'jquery', location: '.', main: 'jquery-2.0.2' }, thanks. either of these solve problem: set dojoconfig.tlmsiblingofdojo = false . define 'foo' package explicit location.

asp.net - Site configured on IIS 8 classic mode - unable to read configuration file -

a web site of ours, designed using wcsf design pattern, using ms practices library, worked fine while configured in iis 6. migrated app new server iis 8. site didn't work in integrated mode unable fetch logged on user context. hence changed "classic mode" , site started work. now following error in site "'cannot read configuration file 'trying read configuration data file '\?\', line number '0'. data field contains error code" we have restart server if receive error. i want know if problem in using "classic mode" in iis 8 or other problem. iis event viewer doesn't give more error mentioned above. please if other configuration needs done or missing here.

actionscript 3 - AS3 Event architecture -

i'm having difficulty last piece in puzzle on as3 events. i understand target classes inherit eventdispatch or implement ieventdispatch , can register (amongst other methods) event listeners. however target classes register with? if event happens, how as3 know pass event target classes? regards, shwell. read article event phases , make more sense: http://livedocs.adobe.com/flex/3/html/help.html?content=events_02.html hope helps. have great day.

c# - Wrong result of print in FUNC -

i have problem code, code need print result: 56789 56789 but result is: 99999 99999 why? class program { static int m_k = 0; static func<int>[] p=new func<int>[5]; static void f(int n,func<int>[] t) { if (n>0) { p[m_k] = () => t[m_k](); m_k++; f(n-1,t); } else { p[m_k] = () => t[m_k](); } } static void main(string[] args) { func<int>[] t = new func<int>[5]; func<int>[] s = new func<int>[5]; t[0] = () => 5; t[1] = () => 6; t[2] = () => 7; t[3] = () => 8; t[4] = () => 9; (int = 0; < 4; i++) { s[i] = () => t[i](); } (int = 0; < 4; i++) { console.writeline(s[i]()); } f(4,t); (int = 0; < 4; i++) { console....

hibernate - Database design consideration on foreign-key both way between two tables -

i have 2 class, user , status , while user have number of status, naturally many-to-one relation , can mapped db tables. however, requirement need user maintain “current” status, i.e., in user table, need have foreign-key status table. result of having 2 foreign-keys between 2 tables in opposite direction. one obvious problem of once records inserted 2 tables, can delete neither of them cause deleting 1 table violate other table's foreign-key. what best design situation? in status table , add column determine whether status record "current" or not. * * for performance issues , can set "current" status records '1' value , rest null value you don't have use 2 foreign keys , 1 - status user. if using hibernate post's tag :) can create view in database select "current" status records , have same structure status table. connect view user entity using one-to-one relation, i hope helped !

IIS and COM+ Partitions: Failed to create ASP Application XXX due to invalid or missing COM Partition ID -

i have application uses com+ components. trying make application work on multiple applications in iis. each application has own application pool. why need separate com+ components 1 each application. way isolate com+ applications use com+ partitions. i created partitions in component services admin tool, on windows server 2008 r2 server. created partitions , created com+ application inside each 1 of them. in iis have separate websites run in different application pools. configure each website use partition , assign partition guid exists. after set iis partition guid , enable use partitions then, after iisreset, run website in browser , receive http 500 internal server error. looked event viewer , error message: failed create asp application xxx due invalid or missing com partition id . if disable use of partitions in component services admin tool , disable usage of partitions in iis application works. need able use partition allow multiple websites run in same time these com+...

c++ - How to allocate Array of Pointers and preserve them for multiple kernel calls in cuda -

i trying implement algorithm in cuda , need allocate array of pointers point array of structs. struct is, lets say: typedef struct { float x, y; } point; i know if want preserve arrays multiple kernel calls have control them host, right? initialization of pointers must done within kernel. more specific, array of struct p contain random order of cartesian points while dev_s_x sorted version x coordinate of points in p . i have tried with: __global__ void test( point *dev_p, point **dev_s_x) { unsigned int tid = threadidx.x + blockidx.x * blockdim.x; dev_p[tid].x = 3.141516; dev_p[tid].y = 3.141516; dev_s_x[tid] = &dev_p[tid]; ... } and: int main( void ) { point *p, *dev_p, **s_x, *dev_s_x; p = (point*) malloc (n * sizeof (point) ); s_x = (point**) malloc (n * sizeof (point*)); // allocate memory on gpu cudamalloc( (void**) &dev_p, n * sizeof(point) ); cudamalloc( (void***) &dev_s_x, ...

android emulator - Unfortunately, the app has stopped -

i'm beginner , trying android tutorial google maps on emulator, every time try run app, have following message unfortunately, <app name> has stopped i have tried code tutorial, nothing more this, , doesn't work! thanks help! you in code debugging window error messages include line number failure occured , include message here if can't figure out.

hibernate - Handling the browser back button in Spring + Tiles (Java Application) -

i developing project management system in spring + tiles. now have project list page project name listed... on clicking link redirect me information page(proj info page). in page have link delete project. after deleting project again redirected project list page.. problem project list page if press button of browser shows me project info page opened earlier. (it displays page cash memory) when browser button clicked not go again in controller renders page cache. writing code of controller in try catch block won't me problem. so can me how handle button of browser???? but before please note: 1. don't want disable browser button 2. don't want use "no-cache" header (meaning want cache maintained) .. please me appropriate solution

ios - Get JSON array without dictionary? -

i've got array in json i'm trying receive. can find examples showing how kind of array: [ { "text": "pain intensity", "question_number": 1, "id": 1 }, but array in format: [ [1, "http://youtu.be/ow9mji25fye", "video", "text here"], [2, "http://gardenwebs.net/butchart.gardens.jpg", "image", "text here"] ] is there way this? or need change json? thinking have assigned value variable x, in first way, value, "pain intensity" write, x[0].text in second method, value 1 , x[0][0] , "[http://youtu.be/ow9mji25fye", "video", "text here"] have write x[0][1] first type written in mixture of array , object. 2nd method pure array. but note both json.

sql - Count single occurrences of a row item -

i count number of times item in column has appeared once. example if in table had... name ---------- fred barney wilma fred betty barney fred ...it return me count of 2 because wilma , betty have appeared once. here sqlfiddel demo below query can try: select count(*) (select name table1 group name having count(*) = 1) t till above post actual post. below post modified question: in oracle can try below query: select sum(count(rownum)) table1 group "name" having count(*) = 1 or here sqlfiddel demo in sql server can try below query: select count(*) table1 left join table1 b on a.name=b.name , a.%%physloc%% <> b.%%physloc%% b.name null or here sqlfiddel demo in sybase can try below query: select count(count(name)) table group name having count(name) = 1 as per @user2617962's answer. thank you

java - Convert Iterable to Array -

i need return string array. use guava split string . please see code below iterable<string> arrayofvalues = splitter.on(";").split(mystring); it returns iterable . need string[] . there way give iterator< element > , convert array[] . many thanks use iterables.toarray(iterable<? extends t> iterable, class<t> type) method in guava.

java - Passing an array to activity (Android) -

in activity a, have built array q1 of question , passed activity b: intent = new intent(getapplicationcontext(), b.class); i.putextra("questions", q1); startactivity(i); finish(); in activity b: object c= getintent().getextras().getserializable("questions"); now, how can reconvert "c" in array of questions? can not make cast (question[]) this helpful. question[] questions = (question)context.getintent().getextras().get(key)

c# - How to get around storing a usercontrol out of process in session state -

i attempting store usercontrol in session state between postbacks, using sql stateserver. i class not serializable error: unable serialize session state. in 'stateserver' , 'sqlserver' mode, asp.net serialize session state objects, , result non-serializable objects or marshalbyref objects not permitted. same restriction applies if similar serialization done custom session state store in 'custom' mode. stack trace serializationexception: type 'asp.bookingcontrols_controls_ucdates_ascx' in assembly 'app_web_eckjngpu, version=0.0.0.0, culture=neutral, publickeytoken=null' not marked serializable.] now, marking usercontorl class serializable, still error. research have determined, far, usercontrol cannot serialized. fine. the general proposed idea around this, seems to split control (data) control (interface/front end), , rebuild on other side. now, before attempt make impacting changes code, question following: will object derive...

c - Write a block to SD with SPI, strange response from SD -

here code writing 512byte block sd card. code works fine, when check went (by reading response sd), read 0xff . that values should (from sd reference manual): ‘010’—data accepted. ‘101’—data rejected due crc error. ‘110’—data rejected due write error this code: uint8_t sdcard_sendblock(uint32_t block, uint8_t * data) { switch (sd_write_blk_machine.fields.state) { case write_start: //enable card gpioc_pdor &= ~gpio_pdor_pdo(gpio_pin(10)); sd_cmd_arg.sd_cmd_tot_argument = block << sd_block_shift; sd_write_blk_machine.fields.state = write_send_cmd24; /*inizializzo le variabili locali*/ write_send_data_counter = 0; sd_cmd_machine.sd_cmd_machine = 0; break; case write_send_cmd24: send_command_return = sdsendcmd(cmd24|0x40,aspected_ok_response); if( send_command_return == sdcard_cmd_fails) { //disable card gpioc_pdor |= gpio_pdor_pdo(gpio_pin(10)); sd_write_blk_machine.f...

ios - change a property in another viewcontroller -

i've searched how run method viewcontroller on stackoverflow , didn't find answer. have viewcontroller1 playing audio using avaudioplayer , want viewcontroller2 able change it's volume. i've tried basic: calling method in viewcontroller2 changes volume in viewcontroller1 . doesn't work. method able output logs isn't able change properties. thanks you need pass message viewcontroller2 viewcontroller1 . either use: 1. notifications 2. delegation here link tutorial if unaware of both of them. http://devinsheaven.com/cocoa-tutorial-passing-messages-between-objects-notifications-delegates-and-target-action/

php - download image from another server url without saving in my server folder -

i have problem in download image url, $url = 'http://example.com/image.php'; $img = '/my/folder/flower.gif'; file_put_contents($img, file_get_contents($url)); in code file saving in server folder .but needed without saving in server needs download user. set correct header , echo out instead of file_put_contents $url = 'http://example.com/image.php'; header('content-disposition: attachment; filename:image.jpg'); echo file_get_contents($url);

responsive design - Without Image dimension affect site speed -

i designing responsive website. in responsive web designing cannot specify image width , height in "img" tags. without width , height site slow. there solution this? you can duplicate image, 1 large screen , 1 small screens ( thumbnail ). <img src="large.jpg" alt="images alt big screens" class="show-for-large"/> <img src="small.jpg" alt="images alt small screens" class="show-for-small"/> css: .show-for-large {display:block;} .show-for-small {display:none;} @media screen , (min-device-width : 320px) , (max-device-width : 480px) { .show-for-large {display:none;} .show-for-small {display:block;} } and can display:none small img large screen , on responsiveness can display:block; the browser doesn't render elements display none, can trick.

ruby - Warning! PATH is not properly set up, usually this is caused by shell initialization files -

whenever go folder .rvmrc file, there warning: warning! path not set up, '/home/me/.rvm/gems/ruby-2.0.0-p247/bin' not available, caused shell initialization files - check them 'path=...' entries, fix run: 'rvm use ruby-2.0.0-p247'. i did rvm use ruby-2.0.0-p247 , warning still present. note : there no errors, im able run application fine, warning annoying. ideas? this bug , handled https://github.com/wayneeseguin/rvm/issues/2050 , released rvm stable 1.21.15 @ 2013-07-29 19:15:30 -0700

jquery - Auto change JSlide -

i'm using jslide create carousel friend, have problem changing of slides. is possible change automatically slide through each 1 @ specific time interval? example, let's 5s delay before slider changes? another thing removal of pagination buttons, i'm assuming remove pagination code function? i'm not entirely sure anyway, here's whole code below: html <div class="slidescontainer"> <div id="slides"> <img src="http://i39.tinypic.com/30sh5wo.jpg" alt="banner 1"> <img src="http://i41.tinypic.com/w5gds.jpg" alt="banner 2"> <img src="http://i41.tinypic.com/17rd3l.jpg" alt="banner 3"> <img src="http://i40.tinypic.com/4u8ajn.jpg" alt="banner 4"> <img src="http://i42.tinypic.com/30a8l1g.jpg" alt="banner 5"> <img src="http://i39.tinypic.com/259x57a.jpg...

c# 4.0 - Get the server name and ip address in C# 2010 -

get server name , ip address in c# 2010 i want ip address of server. following code comes from: public static void dogethostentry(string hostname) { iphostentry host; host = dns.gethostentry(hostname); messagebox.show("gethostentry({0}) returns:"+ hostname); foreach (ipaddress ip in host.addresslist) { messagebox.show(" {0}"+ ip.tostring()); } } this code must know name of server computer. addressfamily in system.net.ipaddress system.net.ipaddress i; string hostname = i.addressfamily.tostring(); error ------------->use of unassigned local variable 'i' how can name of server computer? public string[] servername() { string[] strip = displayipaddresses(); int countip = 0; (int = 0; < strip.length; i++) { if (strip[i] != null) countip++; } string[] name = new string[countip]; ...

c# - Unable to dynamically update display report in Report Viewer Control -

Image
i using following code change reports displayed in report viewer control on button click event. private void reinitializeviewer(string tsreport) { reportdatasource reportdatasourcex = new reportdatasource(); this.purchasereprotviewer.reset(); this.purchasereprotviewer.localreport.reportembeddedresource = tsreport; if (tsreport.contains("rpt_purchaseinvoice.rdlc")) { this.purchasetableadapter.fill(this.gmsdataset.purchase); reportdatasourcex.name = "purchaseinvoicedataset"; reportdatasourcex.value = this.gmsdataset.tables["purchase"]; } else { reportdatasourcex.name = "dataset1"; // reportdatasourcex.value = me.mybindingsource1 } this.purchasereprotviewer.localreport.datasources.add(reportdatasourcex); //this.purchasetableadap...

BB10 cascades linking of contacts -

i developing application on bb10 cascades. i have contact attribute 'attr1' , contact b attribute 'attr2'. next, link contacts , b. when receive contactdetails cascades api , returns contact attributes 'attr1' , 'attr2'. how can detect attribute 'attr1' belongs contact , attribute 'attr2' belongs contact b? you can check merged accounts using mergedcontacts , check attributes each contact returns.

javascript - JS get param from url hash -

console.log(_get("appid")); in fucn _get need check if param exist , return if exist. function _get(paramname) { var hash = window.location.hash; // #appid=1&device&people= //this needs not static if (/appid=+\w/.test(window.location.hash)) { //and somehow parse , return; } return false; } i expect see 1 in console , if console.log(_get("device")) or people null you need use string.match , pass in regexp object instead: function _get(paramname) { var pattern = paramname + "=+\w"; return (window.location.hash.match(new regexp(pattern, 'gi'))) != null; }

php - Requiring a fork with composer that other dependencies should use -

i have laravel project use own fork (that has merged couple of pull-requests). following composer.json works expected (it fetches master branch repo): { "repositories": [ { "type": "vcs", "url": "http://github.com/rmasters/framework" } ], "require": { "php": "5.4.*", "laravel/framework": "dev-master" }, ... "minimum-stability": "dev" } however when add package depends on illuminate components provided laravel (for example, zizaco/entrust requires same versions provided fork) end this: installing gexge/laravel-framework (4.0.x-dev 87556b2) reading .../composer/cache/files/gexge/framework/87556b.....c382.zip cache loading cache extracting archive reason: zizaco/entrust dev-master requires illuminate/support 4.0.x -> satisfiable laravel/framework [v4.0...

Server Explorer in Visual Studio(2010) -

i'm working on visual studio(2010) , using server explorer database connectivity(sql server) . able connect sql client easily, problem i'm facing using "where" clause in sql query. when write simple sql query "select * employee" executing fine, when write "select * employee empno=1001 " gives following error: error in clause near 'employee'. unable parse query text. then when click continue error comes is: sql execution error: error source: .netsqlclientdataprovider error message: expreesion of non-boolean type provided condition expected , near 'no' can please hepl it..?? from error message must putting space between emp , no. if empno fieldname 2 words in table, surround [] eg; [emp no]

c++ - Reverse Fish-Eye Distortion -

i working fish-eye camera , need reverse distortion before further calculation, in question happening correcting fisheye distortion src = cv.loadimage(src) dst = cv.createimage(cv.getsize(src), src.depth, src.nchannels) mapx = cv.createimage(cv.getsize(src), cv.ipl_depth_32f, 1) mapy = cv.createimage(cv.getsize(src), cv.ipl_depth_32f, 1) cv.initundistortmap(intrinsics, dist_coeffs, mapx, mapy) cv.remap(src, dst, mapx, mapy, cv.cv_inter_linear + cv.cv_warp_fill_outliers, cv.scalarall(0)) the problem this way remap functions goes through points , creates new picture out of. time consuming every frame. way looking have point point translation on fish-eye picture normal picture coordinates. the approach taking calculations on input frame , translate result coordinates world coordinates don't want go through points of picture , create new 1 out of it. (time important us) in matrices mapx , mapy there point point translations lot of points without complete translation. tried...

php - Can only see friends lists if logged in with user id of 1 -

i'm implementing friends list system on site, , i've gotten display friends names have accepted(therefore accepted has value of 1), , when visit dummy accounts can see friends, when logged in dummy account can see either, manually changed user_id in database "1" , logged out , in , discovered it's working user_id of 1, here code. it's not mysqli yet, that's next step. <h1>friends</h1> <?php $user_id = user_id_from_username($username); if($_session['user_id'] == $user_id){ $logged_user_id = $_session['user_id']; $result = mysql_query("select * `friends` `friend_id`='{$logged_user_id}' , `user_id`!='{$logged_user_id}' , `accepted`='1'"); while ($row = mysql_fetch_array($result)){ $friend_id = $row['user_id']; /*get friend details*/ $fetch_details = mysql_fetch_object(mysql_query("select * `users` `user_id`='{$friend_id}'")...

uiimage - Objective C: Sharpen images created with CGContextdrawPDFPage -

i create uiimages pdf cgcontextdrawpdfpage. the quality wasn´t satisfying tried cgcontextsetinterpolationquality(context,kcgrenderingintentdefault); and worked out. quality of resulting images still not enough. image looks totally blurry on ipad. can tell me how can increase quality , sharpen image bit? thanks help. i better results using uigraphicsbeginimagecontextwithoptions instead of uigraphicsbeginimagecontext for beginning image context. the parameter scale set 0.0 did trick.

object - Sending a class member function as an argument of glutDisplayFunc -

i trying send member function of class vertices argument of glutdisplayfunc in main getting error : error 1 error c3867: 'vertices::draw': function call missing argument list; use '&vertices::draw' create pointer member 2 intellisense: pointer bound function may used call function c:\users\danish\documents\visual studio please me out.....the code below #include <glut.h> class vertices { private: float x1; float x2; float y1; float y2; public: vertices(float a, float b, float c, float d) { x1 = a; y1 = b; x2 = c; y2 = d; } void draw() { glclear(gl_color_buffer_bit); glcolor3f(1.0, 1.0, 1.0); glbegin(gl_polygon); glvertex3f(x1,y1,0.0); glvertex3f(x2,y1,0.0); glvertex3f(x2,y2,0.0); glvertex3f(x1,y2,0.0); glend(); glutswapbuffers(); } }; void timer(int ...

asp.net - How Get All duplicate record using linq -

in project i'm having critical problem: have collection of employee s in collection. of employee s have same lname : public class employee { public int id { get; set; } public string fname { get; set; } public string mname { get; set; } public string lname { get; set; } public datetime dob { get; set; } public char gender { get; set; } } public class myclass { public list<employee> getall() { list<employee> emplist = new list<employee>(); emplist.add(new employee() { id = 1, fname = "john", mname = "", lname = "shields", dob = datetime.parse("12/11/1971"), gender = 'm' }); emplist.add(new employee() { id = 2, fname = "mary", mname = "matthew", lname = "jacobs", dob = dat...

Should a Git push be uploading files/directories? -

i coming off of old-fashioned ftp workflow , having trouble getting development → staging → production git process working. able connect both staging , production servers via ssh/git. i created empty repository on staging server , attempted push local dev repository. appeared work. however, file seemed upload big 2+gb file in .git folder. none of directories upload. way works or doing wrong? cannot figure out how take local project , push server way used doing in ftp. any appreciated. take @ codeschool's interactive lesson github. http://try.github.io/levels/1/challenges/1 it explains of stuff started

angularjs - angular ng-repeat expressions as variables -

i'm trying this: <ul> <li ng-repeat="{{myrepeatexpression}}">{{row.name}}</li> </ul> but because ng-repeat logic in compile state of directive treats {{myrepeatexpression}} normal string instead of variable. doesn't work, obviously. is there workaround that? you can use , expression ng-repeat , not interpolated value. in order create dynamic repeatable list can try either: using function returns list dynamically in ng-repeat - this potentially more expensive since angular needs call function first determine if collection has changed when doing $digest cycle $watch particular variable on scope trigger change of list - potentially more efficient if dynamic list depends on more 1 variable can more verbose , can lead potential bugs forgetting add new $watch when new variable required demo plunker js: app.controller('mainctrl', function($scope) { var values1 = [{name:'first'}, {name:'se...

Language Reference, Font-family -

there 3 basic languages used on website. put lang="en" in html tag. in css file write following: body { ... font-family: 'open sans'; font-size: 10pt; ... } so, if text on website in english either russian uses web font called open sans . , works ok. now want make when write text in armenian use web font arian amu , doesn't work way: font-family: 'open sans', 'ariam amu'; in css, write :lang(hy) { font-family: 'arian amu'; font-size: 10.5pt; line-height: 18px; } and put lang="hy" in p tags when whole text in armenian. the question is, how can make if language russian or english, writes in open sans 10pt , when it's armenian, ariam amu 10.5pt , line-height of 18px. the pseudo-class :lang has more specificity element selector body . may cause issues when 2 rules conflict, in case. try specifying conflicting rules same specificity: :lang(en), :lang(ru) { font-family: '...

c# - Converting from 'WordOpenXML' to In-Memory System.IO.Packaging.Package -

when using vsto 2012 manipulate ms word document, see document has 'wordopenxml' string property, xml representation of files constituting .docx package saved disk when saving word document .docx. i want convert string equivalent system.io.packaging.package object in memory . the so question here similar. indeed, op mentions 'in memory' in question. however, answers given involve saving package disk using system.io.packaging.zippackage.open method. not want save package disk , have open again using wordprocessingdocument.open() method. rather, want done in memory , not involve file system @ all. i see wordprocessingdocument.open() has overload takes stream. however, i'm not sure how prepare such stream wordopenxml string, although suspect post referenced above gives of answer. you can use method in memory stream wordopenxml string: /// <summary> /// returns system.io.packaging.package stream given word open xml. /// </summar...

ip address - Run command prompt commands in c# -

is there way run command prompt commands within c# application? need name of computer way can access typing in cmd prompt. nslookup myipadress like if ip 134.123.12.12 type; nslookup 134.123.12.12 and value returns after name: after. how in c# console application? i've tried using string name1 = environment.machinename; console.writeline(name1); string name2 = system.net.dns.gethostname(); console.writeline(name2); string name3 = system.net.dns.gethostentry("localhost").hostname; console.writeline(name3); string name4 =dnslookup("134.123.12.12"); string name5 = system.net.dns.gethostentry(134.123.12.12).hostname; console.writeline(name5); but none of these produce correct name, give me server/host name of computer. ideas? i got code might work you. here give internet name: string name = system.net.dns.gethostentry("192.168.1.254").hostname; console.writeline(name); console.readline(); and here give ip address: system...

importerror - how to understand dot notation in this Django blog app -

i learn book python web development django covers django 1.0 . on other hand, use django 1.5.1 , python 2.7.5 . stuck @ 'making blog's public side' session. i open blog/views.py file , type following: from django.template import loader, context django.http import httpresponse mysite.blog.models import blogpost def archive(request): posts = blogpost.objects.all() t = loader.get_template('archive.html') c = context({ 'posts': posts }) return httpresponse(t.render(c)) next step, edit mysite/urls.py looks this: url(r'^blog/', include('mysite.blog.urls')), and last step, make new file, mysite/blog/urls.py , containing these lines: from django.conf.urls.defaults import * mysite.blog.views import archive urlpatterns = patterns('', url(r'^$', archive), ) but, when try open http://127.0.0.1:8000/blog/ , arised exception value: no module named blog.urls . after doing research, found problem lit...