Posts

Showing posts from August, 2013

c# - Addin failing to install in monodevelop -

i wrote addin using addinmaker monodevelop , wile works in debug mode, can't manage install package version. i packaged release version in ./bin/release folder according official tutorial mdtool setup pack <myaddin>.dll when installing addin usig mpack file, unhelpful the installation failed message without other information. from understand, addinmaker uses nuget packages. need run special command packaging? is there way find went wrong installation?

Build compound predicate from list in Prolog -

this question has answer here: list of predicates in prolog 1 answer if have list of predicates in prolog [flies, swims] , how can build predicate conjunction of predicates in list, ie fliesandswims(x) :- flies(x), swims(x). ? alternatively, there better way of building predicate @ runtime without putting component predicates in list , building compound 1 them when needed? edit: turns out duplicate of list of predicates in prolog . had found answer, thought returned whether given atom matched every predicate in list. didn't realise can pass variable instead of atom , have return every case matches well. library(lambda) powerful, has cost. if think 'simpler better' (wrt debugging, specially...) consider call_unary_list([], _). call_unary_list([p|ps], x) :- call(p, x), call_unary_list(ps, x). let's compare performances: compar

c++ - Pass by Reference Address passing issue -

this question has answer here: pass reference / value in c++ 6 answers #include<iostream> using namespace std; void callbyreference (int &); //function prototype int main() { int num; //variable declaration cout<<"enter number"; cin>>num; callbyreference(num); //function definition cout<<"number after triple "<<num<<endl; return 0; } void callbyreference (int & cref) //funciton definition { cref=cref*cref*cref; } if passing address in cref address should multiplied thrice. how value multiplied thrice? you have reference variable argument, variable altered , not address itself. reference variable alias actual variable , changes made reflect in changes made original variable in case

android - release and unload methods of the SoundPool -

do have use release or unload methods of soundpool object after using it. mean, there memory leakage problem when close application if don't use release or unload methods? yes, must! i create separate sound class (sort of utils), has play, load, unload etc methods. access these of activities in static fashion i.e. unload sound onstop() or onpause() , load sound in onresume(). make sure use application context load sounds lest end leaking memory (if use activity context)

php - How to get element with multiple class names? -

i'm having trouble retrieving nodevalue of specific li-tag 4 class names. class name "b-programm_ended" uniquely identifies it. <?php $dom = new domdocument; $dom->loadhtmlfile('https://tv.mail.ru/channel/1296/65/'); $xpath = new domxpath($dom); $classname = 'b-programm js-schedule_item js-remind_prnt b-programm_ended'; $results = $xpath->query('//*[@class="'.$classname.'"]'); echo $now = $results->item(0)->nodevalue; ?> this not real issue. unfortunately, aren't ever going able find elements class b-programm_ended . looked @ source of https://tv.mail.ru/channel/1296/65/ , not find b-programm_ended strings. however, inspected dom chrome , did find instances of b-programm_ended . means class attributes being created jquery, server-side php parsing not find tags. however, when inspect xhr requests same site, there json data being pulled https://tv.mail.ru/ext/

mysql - Create and get dynamic variable with php -

i know question been asked , answered, , not sure proper question should ask, pardon me :d what im trying is: i got table, value mysql , paste table through loop for each row give button (edit button) i give each button id of value through variable $id (eg. 1 2 3 4 ) my question how can specify button press $_post? tried every way think of not work ( in code below warp id variable=asdf static can last value of id) $viewvalue = mysqli_fetch_all ($result, mysqli_assoc); <?php if (count($viewvalue) > 0): ?> <table id="t01"> <thead> <tr> <th><?php echo implode('</th><th>', array_keys(current($viewvalue))); ?></th> <th>edit</th> <th>delete</th> </tr> </thead> <tbody> <?php foreach ($viewvalue $row): array_ma

c# - Windows Phone 8.1 listview click to change page -

for school have make windows phone 8.1 program (in mvvm style) i’m stucked. i have list of cocktails , them in listview, dynamically bindings: <listview itemssource="{binding cocktails}" itemtemplate="{staticresource allcocktailstemplate}" > </listview> it looks that: http://hpics.li/08e9e96 it works want when click on cocktail, change page go page of cocktail. the navigation works don’t know how on listview each cocktails (which db) i’m on yesterday morning, found nothing useful me on internet hope me :p if need more informations, ask me jonny listview/gridview have itemclick event, subscribe it xaml: <listview itemclick="onpostitemclick" isitemclickenabled="true"> code: private void onpostitemclick(object sender, itemclickeventargs e) { // navigate cocktail page item click/tap on frame.navigate(typeof(yourpage), e.clickeditem); } if want use command itemclick event need add behavi

java - Runnable jar does nothing,resources not exporting -

Image
i have created media player, when run in eclipse works fine but when export runnable jar , try run, nothing.. may because images in resource folder not being exported while creating jar, when run using "java -jar" command jar file runs image icon not there playicn = new imageicon("resources/play.png"); pauseicn = new imageicon("resources/pause.png"); stopicn = new imageicon("resources/stop.png"); creating icon using code. any suggestions ?? you have use this.getclass().getclassloader().getresourceasstream('file-name') . in eclipse take path relative class why working. in case this.getclass().getclassloader().getresourceasstream("resource/image1.jpeg") might help.

ios - Why do I have to set trailing space to -16 in Interface Builder to get full screen width? -

Image
i'm building ios application , have menu appears bottom , can opened upwards swipe. doing programmatically works easily. since learn how in interface builder gave try , interface builder driving me crazy. what did: create new view controller in story boards. add arrow controller shown first. add view bottom of view controller's view. let's call view menu. set constraints menu: leading space, trailing space , bottom space superview 0 , height 100. seems should fine. when run application, happens: yellow background colour of main view , red background colour of menu. only way make menu full width if set leading , trailing space -16. not make sense me! am doing wrong? don't think should complicated.

c# - Attempted to read or write protected memory. This is often an indication that other memory is corrupt. when using OpenFileDialog -

i using open file dialog dragged toolbox onto form. file dialog working fine until recently. i've searched high , low answer online none of them work. started project on home computer , copied whole project folder work computer can work on both @ home , @ work. the file dialog works fine on work computer after make changes code (at work) , copy new project folder home computer issue occurs. not managed in tfs or other shared location. private project working on. code issue occurs below: thread th; private void btnuploadtodb_click(object sender, eventargs e) { try { openfiledialog1.title = "select new data file"; openfiledialog1.filter = "excel files |*.xlsx"; if (openfiledialog1.showdialog() == dialogresult.ok) { string filepath = openfiledialog1.filename; } else if (dialogresult == dialogresult.none) { return; } th = new thread(uploadtodb

Get all associated data for all records of a model type in Rails? -

how meld getting of associated data of records of given model? i have following models: user --n:1--> reservation <--1:n-- concert so pseudo-code: reservation belongs_to user reservation belongs_to concert user has_many reservations user has_many concerts through reservations concert has_many reservations concert has_many users through reservations how make single big array of everything? i can reservations via reservation.all i can user particular reservation via reservation.find(25).user i can concert particular reservation via reservation.find(25).concert but how of them? if do reservation.all.each |res| res.user.name+","+res.concert.name+","+res.concert.date # etc. end then 2 new database queries each reservation loops through. 10 records, might not matter, thousands, can painful. add other associations (e.g. concert belongs_to venue, user has_one email, etc.)... is there way say, "get of reservations , following attach

c# - How to get column or selected cell values using objectlistview? -

Image
i want copy content of selected column or cells using objectlistview . when draw selected rectangle using mouse , try ctrl + c copies content of selected row's , columns not want it. 2ndly want add serial number header of row.is object list view allow or handle automatically configuration. if see image. if press ctrl + c ctrl + v copies rows this: zafbgb003ynbgz6 b003ynbnz6 $22.61 $22.40 $ -0.21 % -0.93 1 2391817 acceptable merchant 21 10 zafbnb003ynbnz6 b003ynbnz6 $126.69 $22.40 $ -104.29 % -82.32 1 2391817 new acceptable merchant 21 10 while want copy these values this. 2391817 2391817 if know column want, can simple this: var olvcolumn = olv.getcolumn(6); // whichever column want var sb = new stringbuilder(); foreach (object model in olv.selectedobjects) sb.appendline(olvcolumn.getstringvalue(model)); var selectedcellsastext = sb.tostring(); now, can selectedcellsastext

jquery - Remove hover effect, if next element is visible -

i created simple box, should open/close while clicking on show content. want user hover on h2-element. working, there shouldn't hover effect, when box open. can done css or have use js? $('.box > h2').on('click', function() { $(this).next('div').slidetoggle(); }); .box h2 { padding: .5em; } .box h2:hover { background-color: #ccc; } .box > div { display: none; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="box"> <h2>title</h2> <div>any content</div> </div> there no way css, can add little bit change jquery code achieve using toggleclass() jquery method: just add hover effect in css when <h2> have .closed class , , every time slidetoggle() remove/add .closed class clicked element. can see code modified here:

javascript - Problems with eventHandler arguments using geous.js lib -

i'm having problems retrieve argument passed eventhandler. i'm using geous put map inside , activeadmin interface. solution working on show page didn't things working on index page. idea attach handler dragend event on marker model geographic coordinates. what do: map.locations.add($fields.geousable('getlocation'), { draggable: true, on: { dragend: setfieldslocation }}); and setfieldslocation defined below: function setfieldslocation (event) { alert(setfieldslocation.caller); console.log(event); $('.geousable').find("input")[0].value = event.data.lat; $('.geousable').find("input")[1].value = event.data.lng; }; so first line bind handler (for dragend) , method inside geous lib code attachs , calls when event fired, here snippet: var _onadd = function (locationmarker, opts) { // not relevant code if (options.on) { (event in options.on) {

javascript - Height and width of complete webpage -

i trying height , width of complete webpage regardless of viewport. that is, if browser not maximized, need know complete size of webpage is. methods have looked @ include document.body.clientwidth/clientheight, innerheight/width etc. change when browser made smaller. please help! thanks! --edit-- think have better idea of want. check out scrollheight , scrollwidth properties. document.getelementbyid('width').innerhtml = document.body.scrollwidth; document.getelementbyid('height').innerhtml = document.body.scrollheight; scroll width is: <div id="width"></div> scroll height is: <div id="height"></div> check out properties screen object. availheight , availwidth return screen height , width in pixels available window (excluding interface features such taskbar). these values not change if resize window of browser. try out snippet below: document.getelementbyid('width'

laravel 5 stripe error -

im using laravel 5 , cashier. working except adding cards customer. i'm missing something, don't know what. i these 2 errrors: 1. stripe notice: undefined property of stripe_customer instance: cards 2. php fatal error: call member function create() on null in /app/repositories/billing/stripegateway.php on line 56 the create being referenced: public function createcard($customer_id, $token) { $cu = customer::retrieve($customer_id); //1 $card = $cu->card->create(["source" => $token]); //2 $card = $cu->source->create(["source" => $token]); $card = $cu->source->create(["card" => $token]); return $card; } basically looks customer object isn't referencing card/source object... don't know need do. any appreciated ok helps read api. correct implementation is $card = $cu->sources->create(["source" => $token]); notice sources plural.. using source not

python - List of lists changes reflected across sublists unexpectedly -

i needed create list of lists in python, typed following: mylist = [[1] * 4] * 3 the list looked this: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]] then changed 1 of innermost values: mylist[0][0] = 5 now list looks this: [[5, 1, 1, 1], [5, 1, 1, 1], [5, 1, 1, 1]] which not wanted or expected. can please explain what's going on, , how around it? when write [x]*3 get, essentially, list [x, x, x] . is, list 3 references same x . when modify single x visible via 3 references it. to fix it, need make sure create new list @ each position. 1 way is [[1]*4 n in range(3)] the multiplication operator * operates on objects, without seeing expressions. when use * multiply [[1] * 4] 3, * sees 1-element list [[1] * 4] evaluates to, not [[1] * 4 expression text. * has no idea how make copies of element, no idea how reevaluate [[1] * 4] , , no idea want copies, , in general, there might not way copy element. the option * has make new referenc

android - Palette class is crashing my app on some images -

i making google i/o 2014 music player, , having trouble color extraction album art. here albums screen class: package com.animbus.music; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.graphics.porterduff; import android.graphics.drawable.bitmapdrawable; import android.graphics.drawable.drawable; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.support.v7.graphics.palette; import android.view.menu; import android.view.menuitem; import android.widget.imagebutton; import android.widget.imageview; import java.security.spec.pssparameterspec; public class albums_activity extends appcompatactivity { public bundle b; public string albumname; public string albumartist; public int albumart; public int primarycolor; public int accentcolor; public int titletextcolor; public int subtitletextcolor; public int fabicon; public palette palette; protected void oncreate(

mysql - Error when importing CSV via MAGMI -

when try import large number of products csv file (via magmi ) magento, error: integrity constraint violation: 1048 column 'sort_order' cannot null - error on record #1 there no column or data name 'sort order' on csv file what's causing error? how can solve it? check table or tables data csv being imported to. there should column named sort_order , setup such won't accept null value. map database table column column in csv , make sure column in csv not missing values. need have value in column in csv sort_order column in mysql database not accept null value.

c# - RavenDB many to many and indexes -

need ravendb. in web page want have such list: item1 category1 item2 category2 ... and one: category1, number of items category2, number of items ... my data structures: public class item { public string id { get; set; } public string name { get; set; } public string categoryid { get; set; } } public class category { public string id { get; set; } public string name { get; set; } public bool isactive { get; set; } } index first list: public class item_withcategory : abstractindexcreationtask<item> { public class result { public string name { get; set; } public string categoryname { get; set; } } public item_withcategory() { map = items => item in items select new { name = item.name, categoryname = loaddocument<category>(item.categoryid).name }; } } is data structure suitable

c# - How can i determine the width of a drawn string? -

this question has answer here: how find string's width in c# (in pixels) 2 answers i'm drawing string using following: g.drawstring(somestring, somefont, new solidbrush(color.black), x starts, y starts)); problem: sometimes want align drawn string on left side of line . but, doesn't work if don't know string length be. possible noob solution: count number of chars, multiply trial , error value, , subtract on x position, this: string somestring = convert.tostring(math.round(10 * somevalue) / 10) + "m"; int stringcount1 = somestring.count(); g.drawstring(somestring, somefont, new solidbrush(color.black), x -stringcount1 * trialanderrorvalue, y)); this doesn't work because, can guess, i'm creating number, , number can have decimal separator or not. and problem, because decimal separator not wide character, still counts

search for column names from an array in R -

the columns in data frame called col_rent, col_oil etc i have list of words in array below. if precede of these "col_", column name. > listofwords [1] "rent" [2] "pay" [3] "oil" [4] "gas" [5] "food" i find index of each of these columns. i tried grep follows, want find column numbers of col_rent, col_pay, col_oil, col_gas, col_food without using loop > grep(paste0("cm_",listofwords),names(dfread)) [1] 359 warning message: in grep(paste0("cm_", listofwords), names(dfread)) : argument 'pattern' has length > 1 , first element used however, message says, not allow me grep each member of list. how can end list of numbers, each showing column name these columns occur in data frame. maybe should vectorize operation: sapply(paste0("cm_",listofwords), function( element ) { grep(element,names(dfread)) }) it works me this: > listofwords <-c( "

android - Programatcally remove margin from FrameLayout with LayoutParams -

i have framelayout looks this: <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content"> <framelayout android:layout_margintop="56dp" android:layout_marginbottom="50dp" android:id="@+id/main_frag" android:layout_width="match_parent" android:layout_height="match_parent" /> // other stuff </relativelayout> however when change margins programitcally classcastexception. framelayout fl = (framelayout) findviewbyid(r.id.main_frag); framelayout.layoutparams params = (framelayout.layoutparams) fl.getlayoutparams(); params.setmargins(50, 0, 0, 0); fl.setlayoutparams(params); here how trying: framelayout fl = (framelayout) findviewbyid(r.id.main_frag); framelayout.layoutparams params = (framelayout.layoutparams) fl.getlayoutparams(); para

c# - Need to Get data value prior to binding to row in listview -

i have listview object in asp.net (c#) have listview_itemdatabound() method populated using sqldatasource . in cases, able insert row in listview prior current record being bound. i.e., rows being populated, need able read value bound , insert "header" row mid stream before current row of data added listview . in case of itemdatabound event, data seems bound control rows being added 1 listview row late me anything. listview_itemdatabound() { system.data.datarowview rowview = e.item.dataitem system.data.datarowview; //pseudo code of i'd //if rowview["some_field"]==123 // insert row prior row being bound } i'm relatively new asp.net , come classic asp background maybe i'm thinking , going wrong. suggestions appreciated. instead of doing after you've assigned datasource , called listview.databind() should in datasource. presuming it's datatable : list<int> rowindices = new list<int>();

python - Return existing primary key ID upon constraint failure in sqlite3 -

i have unique constraint on 2 columns of table in sqlite. if insert record duplicate on these 2 columns table, exception ( sqlite3.integrityerror ). is possible retrieve primary key id of record upon such violation, without doing additional select ? if primary key part of unique constraint led violation, have value. otherwise, 2 columns in unique constraint alternate key table, i.e., can uniquely identify conflicting row. if need actual primary key, need additional select. (the primary key of existing row not part of exception because never looked @ during insert attempt.)

angularjs - Socket.io: Not emitting to specific socket.id -

i'm trying loop through each user's array of sockets , send message socketid... it's not receiving on front end reason. i tried these below, no avail. https://github.com/automattic/socket.io/issues/1618 sending message specific id in socket.io 1.0 socket.io: not able send message particular socket using socket.id backend: users.foreach(function(subdoc){ console.log('>> notifyonline: iterating user...') console.log(subdoc); // every socket, send out emit. (var j = 0, arr = subdoc.socketid.length; j < arr; j++ ) { console.log('>> notfiyonline: sending out thoughts clients...'); console.log('>> emitting' + subdoc.socketid[j] + 'is type ' + typeof subdoc.socketid[j] ); // these don't seem io.sockets.to(subdoc.socketid[j]).emit('notification:new', packet); io.to(subdoc.socketid[j]).emit('notification:new', packet); }; // end - each socket }); // end - foreach

show popover on input validation in angularjs -

i want input validation in angularjs. showing bootstrap popover( https://angular-ui.github.io/bootstrap/#/popover ) on when invalid. cannot figure out how trigger popover. user name: <input type="text" name="username" ng-model="user.name" popover="m here" popover-trigger="myform.username.$error.required" required> the [plunker] : http://plnkr.co/edit/pwgquzxzhacvyekebc2o?p=preview to trigger popover using custom conditions have use $tooltipprovider by default can trigger popover : mouseenter, mouseleave, click, focus,blur so have define custom triggers, shown here : http://plnkr.co/edit/0weqzz?p=preview angular.module('myapp',['ui.bootstrap']) .config(['$tooltipprovider', function($tooltipprovider){ $tooltipprovider.settriggers({'customevent': 'customevent'}); }]); angular.module('myapp').controller('mycontroller', ['$scope','

html - How to redirect to a page in my website -

how can redirect mobile users example.com/a example.com/b? don't want desktop users redirected, mobile. tried searching everywhere no luck. you can use jquery detect size of screen. if($(window).width() < 480){ window.location = "mobile.yoursite.com" } jquery works on browser side , resources sent browser before redirect happens. better detection happen on server redirection happens before data sent.

list - Function- and Type substitutions or Views in Coq -

i proved theorems lists, , extracted algorithms them. want use heaps instead, because lookup , concatenation faster. achieve use custom definitions extracted list type. in more formal way, ideally without having redo of proofs. lets have type heap : set -> set and isomorphism f : forall a, heap -> list a. furthermore, have functions h_app , h_nth, such that h_app (f a) (f b) = f (a ++ b) and h_nth (f a) = nth on 1 hand, have replace every list-recursion specialized function mimics list recursion. on other hand, beforehand want replace ++ , nth h_app , h_nth , extracted algorithms faster. problem use tactics simpl , compute in places, fail if replace in proof code. have possibility "overload" functions afterwards. is possible? edit: clarify, similar problem arises numbers: have old proofs use nat , numbers getting large. using binnat better, possible use binnat instead of nat in old proofs without modification? (and especially, replace ine

linux - "Not enough clusters for a 16 bit FAT", but I'm above minimum size. Why? -

i'm trying make fat16 filesystem on ubuntu. so, first create file dd if=/dev/zero of=fat16.bin bs=1024 count=8192 . this create 8mb file full of zeros. then, format file fat16 filesystem issuing following command: mkfs.vfat -f2 -n fat16 -r 224 -s8 -s512 -f16 fat16.bin . but gives me following error. warning: not enough clusters 16 bit fat! filesystem misinterpreted having 12 bit fat without mount option "fat=16" as far i'm concerned, minimum size of fat16 filesystem 4mb, don't understand what's happening here. probably it's says - not enough clusters 16 bit fat . guess needed space calculated, trying e.g. 16mb doesn't cause warning: $ dd if=/dev/zero of=fat16.bin bs=$((1024*1024)) count=16 16+0 records in 16+0 records out 16777216 bytes (17 mb) copied, 0.0561285 s, 299 mb/s $ mkfs.vfat -v -f2 -n fat16 -r224 -f16 fat16.bin mkfs.fat 3.0.26 (2014-03-07) fat16.bin has 64 heads , 32 sectors per track, hidden sectors 0x0000; log

asp.net mvc - Enum object not found with razor -

the object 'yogaspaceaccommodation' i'm using type in getenumdescription seems brown , not found. or here isn't correct in terms of syntax. <div id="accomodationtypeselector"> <select class="form-control" id="spaceaccommodation" name="yogaspaceaccommodation"> <option id="default">0</option> @{ var accomodationvalues = enum.getvalues(typeof(yogaspaceaccommodation)); foreach (var value in accomodationvalues) { var index = (int)@value; var description = @enumhelper.getenumdescription <yogaspaceaccommodation>(@index.tostring()); } } </select> </div> enumdescription looks this public static string getenumdescription<t>(string value) { type type = typeof(t); var name = enum.getnames(type).where(f => f.equals(value, stringcomparison.curr

django - form.cleaned_data returns empty set -

i've got form: class orderform(forms.form): delivery_time = models.charfield(max_length=100) address_city = models.charfield(max_length=40) address_street = models.charfield(max_length=40) address_building = models.charfield(max_length=40) here's view: def submit(request): args = {} args['form'] = orderform() if request.post: order_form = orderform(request.post) if order_form.is_valid(): user = request.user address_city = order_form.cleaned_data.get('address_city') address_street = order_form.cleaned_data.get('address_street') address_building = order_form.cleaned_data.get('address_building') delivery_time = order_form.cleaned_data.get('delivery_time') new_order = order(address_city=address_city, address_street=address_street, address_building=address_buil

PHP post to WebAPI -

well, know headline simple, looking 3 days example on how make post request webapi . currently using jquery post , need php script run , talk c# webapi , , seems impossible find examples or explain on how that. someone gave me code : $response = file_get_contents('http://localhost:59040/api/email/sendemails'); $response = json_decode($response); echo ($response); but 1 nothing - not error on how go more problem. i simpley need php script make post request webapi gets 1 param(string) , return ok answer or error, after maalls answer post how send post request php? the answer simple , code following : $url = 'http://server.com/path'; $data = array('key1' => 'value1', 'key2' => 'value2'); // use key 'http' if send request https://... $options = array( 'http' => array( 'header' => "content-type: application/x-www-form-urlencoded\r\n", 'method&

c# - Set style of TextBlock programatically -

i have this: var mytext = new textblock(); mytext.text = "blah"; mytext.style = /* ??? */; in xaml, can set style this: <textblock text="blah" style="{themeresource listviewitemtextblockstyle}"/> but how do in c#? edit: error 1 'windows.ui.xaml.application' not contain definition 'findresource' , no extension method 'findresource' accepting first argument of type 'windows.ui.xaml.application' found (are missing using directive or assembly reference?) error 1 'geodropper.hubpage' not contain definition 'findresource' , no extension method 'findresource' accepting first argument of type 'geodropper.hubpage' found (are missing using directive or assembly reference?) when tried (style)this.findresource("listviewitemtextblockstyle"); , (style)app.current.findresource("listviewitemtextblockstyle") got these errors. thank decoherence! nee

php - Trying to convert code from MySQL to MySQLi -

this question has answer here: mysqli_query expects @ least 2 parameters 4 answers recently started use older script located here: http://tutorial.ninja/tutorials/web+development/php+-+user+system/58/user+system+%28part+1%29/page-2.html i've been trying edit configuration mysqli rather mysql i'm struggling. changed of this: $conn = mysql_connect("localhost","user","password"); // connect local mysql database username , password mysql_select_db("dbname") or die(mysql_error()); //select database use // query database account details if exist , store them in $logged variable $logged = mysql_fetch_array(mysql_query("select * `members` `id` = '".$_session['id']."' , `password` = '".$_session['password']."'")); to this: $conn = mysqli_connect("local

math - Writing arithmetic code in Java -

i have below 1 line of code: variabledoublevalue = ((10*variabledoublea) + (6.25*variabledoubleb) – (5*variablebytec) + 5); how can write in java understandable code? from infer question, want java-language based variable declaration , assignment. well, if case, result :- //public class mathemathicalexpression{ // public static void main(string[] args){ // double a=some_value,b=some_value,value=0; considering a,b , value of type double // byte c=some_value; considering c of type byte. value = 10 * + 6.25 * b - 5 * c + 5; // } //}

python - pip broke after uninstalling a module -

i used pip uninstall on shapely , got exception, did not save. since every pip or easy install command pop exception : traceback (most recent call last): file "c:\python27\lib\runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) file "c:\python27\lib\runpy.py", line 72, in _run_code exec code in run_globals file "c:\python27\scripts\pip.exe\__main__.py", line 5, in <module> file "c:\python27\lib\site-packages\pip\__init__.py", line 13, in <module> pip.utils import get_installed_distributions, get_prog file "c:\python27\lib\site-packages\pip\utils\__init__.py", line 17, in <module> pip.compat import console_to_str, stdlib_pkgs file "c:\python27\lib\site-packages\pip\compat\__init__.py", line 14, in <module> pip.compat.dictconfig import dictconfig logging_dictconfig file "c:\python27\lib\site-packages\pip\compat\dictconfig.

mysql - time slot database design -

i creating database need allow booking resource start time end time on particular day. example, have 11 badminton courts. these courts can booked 1 hour , can , in day each court takes 18 bookings morning 6 till night 12 pm. (considering each booking 1 hour). price of booking varies day day, example morning charges more day charges. weekend charges more weekdays charges. now question is, advisable pre-populate slots , book user depending on availability. in case abobe example if need store slots next 1 month have store 11*18*30 = 5940 records in advance without real bookings.every midnight need run script create slots. if no of clubs increases number can become huge. design such systems? if not better designs in these scenerios. club name||court || date || start_time || end_time || status || charge || c1 20/04/2015 6:00 7:00 available c1 20/04/2015 7:00 8:00 available . . . c1 20/04/2015 11:00 24:00

yacc - "first use" error when change the code in lex file -

given .l file this: %{ #include "y.tab.h" %} %% [ \t\n] "if" return if_token ; "while" return else_token ; . yyerror("invalid character"); %% int yywrap(void){ return 1; } and .y file this: %{ #include <stdio.h> void yyerror(char *); %} %token if_token else_token minus_token digit_token %% program :expr {printf("program accepted!!!");}; expr : if_token | digit_token ; %% void yyerror(char *s){ fprintf(stderr, "%s\n", s); } int main(){ yyparse(); return 0; } i use these 3 commands compile these 2 files (my lex file named p.l , yacc file named p.y): flex p.l yacc -d p.y gcc lex.yy.c y.tab.c it compiled no error. when changed "return else_token" "return while_token", got error , got no output file: p.l: in function ‘yylex’: p.l:10:8: error: ‘while_token’ undeclared (first use in function) "while" return while_token ; ^ p.l:10:8: note:

enterprise architect - transform reverse engineered physical data model into conceptual entity relationship diagram -

Image
i have reverse engineered physical data model existing db using enterprise architect. looks similar this, imho erm too: can transform erm this?: thanks! not automatically. trying abstraction physics. human can that. need manually. reverse possible via transformation. in case take abstract class model , transform 1 (or many) physical representations.

c++ - how do you change arrays? -

help! im trying replace 'a' , 'e' ' ' in array keeps replacing of array instead. for(int x = 0; x < array_length); x++) { if(city_name[x] == 'a' || 'e') city_name[x] = " "; } if(city_name[x] == 'a' || 'e') should be if(city_name[x] == 'a' || city_name[x] == 'e') your code equivalent to if( ( city_name[x] == 'a' ) || 'e') which city_name[x] == 'a' , checks result of statement || 'e'

android - Using Sliding Tabs with Toolbar -

Image
i've started change using actionbaractivity appcompatactivity , i've started using toolbar instead of standard actionbar . however, in 1 of activities has swiping tab type of layout, following line seems deprecated: actionbar.setnavigationmode(actionbar.navigation_mode_tabs); although have looked @ other answers on stack overflow regarding this, there built-in way of changing support using toolbar . if so, explain how go changing it? how deprecated methods ontabselected changed? also, i've noticed google play music app has looks extended toolbar/section underneath tabs (see this image talking about ). how able have type of layout? thanks in advance. so after few days of lots of research, , looking through github, managed solve problem. steps updating actionbar tabs toolbar tabs using appcompatactivity: update: after friday 29th may 2015: thankfully, using tablayout toolbar has become simpler since announcement of android design support li