Posts

Showing posts from March, 2012

algorithm - Time complexity of union -

we have directed graph g=(v,e) ,at each edge (u, v) in e has relative value r(u, v) in r , 0<=r(u, v) <= 1, represents reliability , @ communication channel, vertex u vertex v. consider r(u, v) probability chanel u v not fail transfer , probabilities independent. want write efficient algorithm finds reliable path between 2 given nodes. i have tried following: dijkstra(g,r,s,t) 1. initialize-single-source(g,s) 2. s=Ø 3. q=g.v 4. while q != Ø 5. u<-extract-max(q) 6. if (u=t) return d[t] 7. s<-s u {u} 8. each vertex v in g.adj[u] 9. relax(u,v,r) initial-single-source(g,s) 1. each vertex v in v.g 2. d[v]=-inf 3. pi[v]=nil 4. d[s]=1 relax(u,v,r) 1. if d[v]<d[u]*r(u,v) 2 d[v]<-d[u]*r(u,v) 3. pi[v]<-u and wanted find complexity of algorithm. the time complexity of initialize-single-source(g,s) o(|v|). time complexity of line 4 o(1). time complexity of line 5 o(|v|). time complexity of l

(Android Studio) App Background Image Doesn't Fill Screen -

i'm new app programming , require assistance. building simple app on android studio, app's background image (i named "green_background") doesn't entirely fill screen. can't provide screenshot because don't have 10 reputation on stack overflow. here app's activity coding. have added 1 piece of text, 2 buttons, 2 chronometers , 1 image view: <imageview android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/imageview" android:layout_alignright="@+id/button2" android:layout_alignend="@+id/button2" android:contentdescription="@string/background_1" android:layout_alignparentend="@+id/button" android:layout_alignparentright="@+id/button" android:background="@drawable/green_background" android:layout_alignparenttop="true" android:layout_alignparentleft="true"

Clarification of nginx and load balancing needed -

i'm reading design of instagram , found such description of load balancing system. every request instagram servers goes through load balancing machines; used run 2 nginx machines , dns round-robin between them. downside of approach time takes dns update in case 1 of machines needs decomissioned. recently, moved using amazon’s elastic load balancer, 3 nginx instances behind can swapped in , out (and automatically taken out of rotation if fail health check). terminate our ssl @ elb level, lessens cpu load on nginx. use amazon’s route53 dns, they’ve added pretty gui tool in aws console. the question is. right have dns server uses rr decide on nginx server send request. , each of nginx servers @ turn resends request cluster? and second question is. difference between nginx , load balancer. why cannot use nginx instead? for first question, believe answer seems instagram uses route53 map dns elastic load balancer, 2 things: routes traffic evenly 3 nginx load balanc

python - error printing Integer with strings -

i beginner python trying write not working. help? cp=input("enter cost price: ") sp=input("enter sale price: ") if (sp>cp): print ("congratulations !! made profit of ", + sp-cp) print("congratulations!! made profit of %f" % sp-cp) elif (cp>sp): print("you in loss of %f" % cp-sp) else: print("you got nothing") in python 3 (which i'm assuming using because of python-3.x tag included), input function returns string, , can't math on string. need change cp=input("enter cost price: ") sp=input("enter sale price: ") to cp = int( input("enter cost price: ") ) sp = int( input("enter sale price: ") ) (spaces added show changed). as answer above said, need add parenthesis around substitution values print("congratulations!! made profit of %f" % sp-cp) becomes print("congratulations!! made profit of %f" % (sp-cp) )

powershell - Error: Cannot get Azure subscription ID and thumbprint. Failed in New-FirewallRuleForWebsite in New-AzureSql.ps1 -

i working through ebook "building cloud apps microsoft azure" , when run new-azurewebsiteenv.ps1 following error error: cannot azure subscription id , thumbprint. failed in new-firewallruleforwebsite in new-azuresql.ps1 i have tried adding -extendeddetails get-azuresubscription in new-azuresql.ps1 , new-azurewebsiteenv.ps1 suggested in http://blogs.msdn.com/b/devschool/archive/2015/04/10/error-in-fixit-demo-cannot-get-azure-subscription-id-and-thumbprint-urghh.aspx i using azure powershell 0.8.16 , windows 7 service pack 1. this can fixed calling remove-azuresubscription re-running import-azurepublishsettingsfile

database - Displaying form data with php and laravel -

hi there trying form data stored in database , show data object on webpage. wanting able edit object's data , update database new information. like comments/post section on blog/facebook thanks can offer specifics/ have below. using laravel 4.2 , sqlite manage everything. think issue routes though. have great day. this directory layout - app -- database ---posts.sql ---comments.sql -- views --- layouts ------- default.blade.php --- pages ------- home.blade.php ------- edit.blade.php --- includes ------- head.blade.php ------- header.blade.php ------- footer.blade.php --routes.php i have 2 databases trying interact add/edit/delete rows. both follow format /* posts database in sqlite. */ drop table if exists posts; create table posts ( id integer primary key autoincrement, number int, /* 0 = subsequent term */ post_username varchar(40) not null, post_title varchar(40), post varchar(140) ); /* column names c

javascript - Ember-data cannot read property 'length' of undefined -

i'm trying data api server ember-data ,i added ember-data ember starter-kit. getting app = ember.application.create(); app.router.map(function() { // put routes here }); app.applicationadapter = ds.restadapter.extend({ namespace: 'emberjs/ember.js', host : 'https://api.github.com/repos' }); app.store = ds.store.extend({     adapter: 'app.applicationadapter' }); app.indexroute = ember.route.extend({ model: function() { return this.store.find('pull'); } }); app.pull = ds.model.extend({ url : ds.attr(), title : ds.attr(), body : ds.attr() }); giving same error every request. try github, gives same error. api connected: github api error while processing route: index cannot read property 'length' of undefined typeerror: cannot read property 'length' of undefined ember expects pluralised root object when returning multiple results, in case pulls , i.e { "pulls&

ios - Missing argument for parameter #1 in call when using findObjectsInBackgroundWithTarget -

Image
i trying array of pfobjects, [pfobject] , parse , seeing issue below. missing? error missing argument parameter #1 in call func loaddata() { rooms = [pfobject]() users = [pfuser] () self.tableview.reloaddata() let pred = nspredicate(format: "user1 = %@ or user2 = %@", pfuser.currentuser()!, pfuser.currentuser()!) let roomquery = pfquery(classname: "rooms", predicate: pred) //gives information - includekey columns user class roomquery.includekey("user1") roomquery.includekey("user2") roomquery.findobjectsinbackgroundwithtarget{ (results: [anyobject]!, error: nserror!) -> void in if error == nil { self.rooms = results [pfobject] room in self.rooms { let user1 = room.objectforkey("user1") pfuser let user2 = room.objectforkey("user2") pfuser if user1.objectid != pfuser.currentuser() {

javascript - 3 Way Binding in Angular & Firebase causing lag in input boxes -

i binding users profile data variable this: // profile management var user = firebase.child('users').child(userid); $firebaseobject(user).$bindto($scope, 'user'); here html: <div ng-show="firebaseuser"> <h1>your profile</h1> <div class="contentcontainer"> <div class="profilepicture"> <img src="images/noprofile.png"> </div> <div class="personalinfo"> <input type="text" ng-model="user.name" ng-change="user.$save()" type="text" label="name" placeholder="your name.." name="username"> <input type="text" ng-model="user.phone" ng-change="user.$save()" type="text" label="phone" placeholder="your phone #.." name="userphone&

blogs - Blogger - Unable to set custom domain name - getting Error 12 and 404 page -

Image
i unable setup custom domain name blogger site, followed instructions mentioned on below link nothing has helped me far (note: been 3 days now). referred link: https://support.google.com/blogger/troubleshooter/1233381?rd=1#ts=1734115 other details: my blogger site: http://sandbox-addedbits.blogspot.in/ my domain www: http://www.addedbits.com/ [note: showing 404 - page not found] domain without www: http://addedbits.com/ [note: showing welcome page] also, find screenshot of blogger's third-party domain settings: godaddy a(host) records: godaddy cname records: my domain name verification has failed using methods mentioned blogger. let me know if can me setup custom domain name blogger site. thank in advance. the same problem facing 4 years , in time did not have solution problem, got forums support team of domain registrar, got article. which having step step guide setting domain name blog- http://www.bloggerhowtoseotips.com/2013/07/how-to-setti

jquery - How to make element sizes to fill cell sizes and increase font in free jqgrid inline and form editing -

jqgrid font size increasing according answer how change font size in jqgrid? using .ui-jqgrid tr.jqgrow td { font-size: 1.2em; } unfortunately not change inline , form editing element font sizes. i'm looking wayto occupy whole cell contents in free jqgrid inline editing , increase font sizes in both form , inline editing. according https://github.com/free-jqgrid/jqgrid/issues/52 created style .jqgrid-inlineedit-element { font-size: 1em !important; box-sizing: border-box; height: 100%; width: 100% } and added style input , select elements using class = "ui-widget-content jqgrid-inlineedit-element" in colmodel. inline editing has nice bigger elements. hovewer jqgrid applies class automatically form editing , causes wide , small height fields in form editing (see below). how fix height: 100%; width: 100% does not apply form editing , font size applies both? i tried fix removing width , height classes , adding them in col

ios - Xcode 6.3 (and 6.2) hits breakpoint on [UIFont fontWithName: size:] -

Image
in ios application im using class (dktheme) keep fonts , images in centralised place. implementation looks this. + (instancetype)theme { static dktheme *_theme = nil; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ _theme = [[dktheme alloc] init]; }); return _theme; } - (id)init { self = [super init]; if (self) { [self setuptheme]; } return self; } - (void)setuptheme { // code here self.smallbuttonfont = [uifont fontwithname:@"helvetica-bold" size:13.0f]; //some code here } and when run code in device (iphone 5c, ios8.3 , ios8.2), xcode hits breakpoint on line self.smallbuttonfont = [uifont fontwithname:@"helvetica-bold" size:13.0f]; if click continue execution button, application continue running without crashing , font property( self.smallbuttonfont ) initialised. and noticed 1 more thing, have several [uifont fontwithname: size:]; calls , breakpoint hits first time call.(if c

c++ - Can a function doing nothing change an object? -

why function doing nothing change object? i have following code: void sample(slist a) { cout << "\nin function"; a.print(); } int main() { srand(500); int total = 10; slist llist; for(int = 0; < total; i++) { llist.add_head(rand() % 100); } llist.print(); llist.print(); sample(llist); llist.print(); return 0; } the output is: 70 69 14 3 18 71 70 17 57 98 70 69 14 3 18 71 70 17 57 98 in function 70 69 14 3 18 71 70 17 57 98 0 34365728 34365696 34365664 34365632 34365600 34365568 34365536 34365504 34365472 my question function sample has nothing related slist, changing slist. how doing that? slist singly linked list. i think pass-by-value. great if shows me point ignorantly missing. edit: answer title question yes. please @ answer. look @ slist's copy constructor , destructor. guess without seeing them copy cons

reactjs - react flux subscription callback , many to many relationships -

i new react , flux. trying build subscription system. many many relation ship confused on how implement callback: the scenario: user a, b, c subscribe item 1. user a, b, d subscribe item 2. user b, c, d subscribe item 3. the items infinite, , users infinite. so in case, if there attribute in item 1 changed, want emit change subscriber a,b,c. due fact items infinite, can't manually create number of callbacks. i imagine there array of callback bind subscribers. , have 1 emit change, find callback index, , perform callback subscribers. could point me correct direction. thanks,

caching - Searching/selecting query in cache -

i have been using cache long time. store data against key , fetch cache whenever required. know stackoverflow , many other sites heavily rely on cache. question use key-value mechanism caching or form sql query within cache? instance, want view last week report. report's content vary each day. need store different reports against each day (where day key) or can result forming query aggregate result across different key? caching product (like redis) provide functionality? thanks in advance cache done key-value hash table. how stays fast. if you're doing querying you're not doing cache. what may trying ask is... have in database table contains agregated report data. , query against pre-calculated table.

angularjs - TypeError: Cannot read property '$fetch' of undefined -

i using angular-js,angular-restmod , ui-router build app has following restmod models app.factory('event', function(restmod) { return restmod.model('v1/events').mix( { user: {belongsto: 'user', key: 'user_id'} } ); }); app.factory('user', function(restmod) { return restmod.model('v1/users'); }); i have controller lists events present in database app.controller('eventscontroller', function($scope,event,user) { $scope.eventslist = []; var events = event.$search(); (event in events) { event.user.$fetch(); } $scope.eventslist = events; }) i getting error - typeerror: cannot read property '$fetch' of undefined line 'e.user.$fetch();' i cannot figure out wrong in code. can please.

Reading Data from File into Array - C -

i'm doing project on kali linux run tool ettercap lists ip addresses on network , saves them .txt. need use these ip's on tool nmap, wanted write c code can save ips ip.txt array. far closest working code: #include <stdio.h> #include <stdlib.h> main(){ file *iplist; iplist = fopen("ip.txt", "r"); int iparray[10]; int i; if (iplist == null) { printf("error\n"); exit (0); } (i = 0; < 10; i++) { fscanf(iplist, "%d,", &iparray[i] ); } (i = 0; < 10; i++) { printf("nmap -a -t4 -f %d\n\n", iparray[i]); } fclose(iplist); return 0; } the resulting output bunch of random numbers. ideas? matter i'm using kali? , iparray set 10; problem if don't have 10 ip addresses? the ip addresses stored this: ip address : 10.0.0.1 ip address : 10.0.0.2 ip address : 10.0.0.3 ip address : 10.0

c# - How to combine the product when the same and when add in a list box? -

how combine product when same? how sum of price? if not same product add in list box. if same product combine , sum of price combine. here's code program. ^_^; public partial class form1 : form { public form1() { initializecomponent(); } private void btnadd_click(object sender, eventargs e) { string product = txtproduct.text; decimal price = convert.todecimal(txtprice.text); lstproductpricebox.items.add( product + " = " + price.tostring("c")); // how combine product when same? , // how sum of price? // if not same product add in list box // if same product combine , sum price. } private void btnexit_click(object sender, eventargs e) { this.close(); } } you need define product class contains productnam

c++ - What is this weird colon-member (" : ") syntax in the constructor? -

recently i've seen example following: #include <iostream> class foo { public: int bar; foo(int num): bar(num) {}; }; int main(void) { std::cout << foo(42).bar << std::endl; return 0; } what strange : bar(num) mean? somehow seems initialize member variable i've never seen syntax before. looks function/constructor call int ? makes no sense me. perhaps enlighten me. and, way, there other esoteric language features this, you'll never find in ordinary c++ book? it's member initialization list . should find information in good c++ book . you should, in cases, initialize member objects in member initialization list (however, note exceptions listed @ end of faq entry). the takeaway point faq entry that, all other things being equal, code run faster if use initialization lists rather assignment.

visual studio 2013 - script files do not work after uploading web app to azure with web deploy configuration set to release -

i have made mvc5 web app hosting on azure. using visual studios web deploy tool upload files azure. if upload web deploy set debug website works flawlessly once on azure. however, if upload web deploy set release scripts ( jquery ) appear disabled. assuming jquery disabled because jquery enabled menu on home page not work. please note problem not related visual studios internal build (release or debug) rather web deploy setting when publishing web app. here bundleconfig file contents public class bundleconfig { public static void registerbundles(bundlecollection bundles) { bundles.add(new scriptbundle("~/bundles/jquery").include( "~/scripts/jquery-2.1.3.min.js", "~/scripts/gridmvc.min.js", "~/scripts/jquery.validate.unobtrusive.min.js", "~/scripts/jquery.datetimepicker.js", &qu

php - Modify MySQL query to also show child records sorted under parent records in a menu -

Image
i need build mysql database driven link menu shows links user has permission view. the link menu have parent , child links. child links under parent links (like directory structure). i have 2 database tables shown below. intranet_links has link records , user_link_permissions has permissions determine if user can view link or not. here current sql query returns links user has permission view... also here working demo see results http://sqlfiddle.com/#!9/8aa75/2 select intranet_links.id, intranet_links.title, intranet_links.url, intranet_links.description, intranet_links.sort_order, intranet_links.parent, user_link_permissions.user_id user_link_permissions join intranet_links on user_link_permissions.link_id=intranet_links.id , user_link_permissions.permission=1 user_link_permissions.permission=1 , user_link_permissions.user_id=1 order title i need results sort in way let child links ordered under parent links. i using ph

javascript - Group subarrays when one value is the same -

i'm trying group data in array of arrays when value @ array[i][0] common. can use array.map() this? i've been toying solution, create new array unique values , compare original array, can't figure out logic craft result highcharts wants. i'm pretty confident if can figure out how array manipulation, can figure out logic automate highcharts, make saturday :) i have: var array = [ ["name1","date1"], ["name1","date2"], ["name2","date1"], ["name2","date1"] ]; and want turn into: var array = [ [ ["name1","date1"], ["name1","date2"] ], ["name2","date1"], ["name2","date2"] ] ]; it may not possible in single loop. inclined create object in first pass, , build data structure in second. like: var obj = oldarray.reduce(function(memo, i

c# - How to use reflection to cast a control as its type in order to modify properties? -

here's example of do: book enable = false; foreach (control c in controllist) { if (c mytextbox) { (c mytextbox).enabled = enable; } if... ... } instead of having multiple if statements every type of control, there way type of control in order cast , able access , set property of control? this great example of when not use reflection. the control class contains enabled property can use descendants of control change enabled state. simple way change enabled state of collection of controls is: bool enable = false; foreach (control c in controllist) c.enabled = enable; or (now you've mentioned system.web.ui namespace) can webcontrol -derived objects, assuming controllist collection can contain things derive control no webcontrol : foreach (webcontrol c in controllist.oftype<webcontrol>()) c.enabled = enable; reflection handy in situations , can pretty cool things it. it's verbose , kind of tough head

ios - Only half the screen visible when using PFLoginViewController -

Image
i trying use pfloginviewcontroller show login , sign screen. see ok can see half screen. below code , see on simulator. can't figure out what's wrong. logo.jpg? (logo.jpg dimensions 916x916) code: class if want copy , make mods: import uikit class loginsignupviewcontroller: pfloginviewcontroller, pfloginviewcontrollerdelegate, pfsignupviewcontrollerdelegate { override func viewdidload() { super.viewdidload() self.delegate = self self.signupcontroller?.delegate = self self.loginview?.logo = uiimageview(image: uiimage(named: "logo.jpg")) self.signupcontroller?.signupview?.logo = uiimageview(image: uiimage(named: "logo.jpg")) } func signupviewcontroller(signupcontroller: pfsignupviewcontroller, didsignupuser user: pfuser) { signupcontroller.dismissviewcontrolleranimated(true, completion: nil) } override func didreceivememorywarning() { super.didreceivememorywarning() } } finally, here screen : seems user

iOS - change language for user via buttons -

Image
im making interactive children's story uses custom graphics , narrations. i have graphics in both english , spanish. i dont have non-custom buttons, no text fields, not single "standard" apple app ui element anywhere. custom png file. im looking method allow user change english spanish or vice-versa. i created custom english , spanish button already, highlight when pressed. the app (from ive read need restarted) , app present spanish pages (and spanish text embedded in png). spanish narration ensue. at point user can elect hit english language button, , return english if desired. tabtale's "mermaid princess" app extremely well, , far more need, example of im after. click button, change region, app restarts, , custom text , narrations result region youve selected. i have 2 regions (languages) need simpler. but how in world pull off ? cheers ! ok, harder had expected… basically exchanging nsbundle's method invoked nsloc

c++ - Drawing large text with GLUT? -

i have created tic-tac-toe game school, , finished. thing have left when wins, want box pop on screen , in big text "x wins" or "o wins" depending on one. i've found drawing text in opengl complicated. since isn't crucial assignment, i'm not looking complicated or , don't need super nice. also, want change code. also, want size of text variable driven when re-size window. this text drawing function looks like. draws small. note: mtext int [2] data member holds want draw text void fullgame::drawtext(const char *string) const { glcolor3d(1, 1, 1); void *font = glut_bitmap_times_roman_24; glblendfunc(gl_src_alpha, gl_one_minus_src_alpha); glenable(gl_blend); int len, i; glrasterpos2d(mtext[0], mtext[1]); len = (int)strlen(string); (i = 0; < len; i++) { glutbitmapcharacter(font, string[i]); } gldisable(gl_blend); } short answer: you drawing bitmap characters cannot resized

java - Error with VariableDeclartorID expected after this token -

i following message on line "private reader = new bufferedreader(new filereader(deleterecord));": syntax error on token "reader", variabledeclartorid expected after token code: import java.io.bufferedwriter; import java.io.bufferedreader; import java.io.file; import java.io.filereader; import java.io.filewriter; import java.io.printwriter; import java.util.scanner; public class examgradesmethods { private static int exammark = 0; private static int menu = 0; private static string firstname = ""; private static string firstnamedelete = ""; private static string lastname = ""; private static string lastnamedelete = ""; private static string unit = ""; private static string entry = ""; private static string firstcap = ""; private static string surcap = ""; private static scanner scan = new scanner(system.in); private static buffere

mysql - Updating Multiple Tables with Join -

i have following query works fine: $query = "update mpt join compounds on compounds.mpt = mpt.id set mpt.supervisor_comments = " . $this->db->escape($comments['mpt']) . " compounds.id = " . $id; and updates mpt table linked a row in compounds table particular id. i try extending query update 2 fields @ once, however, @ point i'm told: unknown column 'mpt.id' in 'on clause' update mpt, bpt join compounds on compounds.mpt = mpt.id , compounds.bpt = bpt.id set mpt.supervisor_comments = 'abcd' compounds.id = 5 even though in previous example worked fine... suggestions or advice? $query = "update mpt, bpt join compounds on compounds.mpt = mpt.id , compounds.bpt = bpt.id set mpt.supervisor_comments = " . $this->db->e

How to define a string using assembly 8086 in Turbo Pascal? -

i can write assembly code. i want use interruption 10h/13h write string screen. can't figure out how define or save in memory string using assembly in turbo pascal. this didn't work: msg1 'hello, world!$' my code: program string; begin asm mov ah,$0 mov al,03h int 10h; mov ax,1300h mov bh,$0 mov bl,07h mov cx,$9 mov dl,$0 mov dh,$0 int 10h mov ah,00h int 16h end; end. anyone knows it? the suffix '$' termination character available dos functions. int 10h / ah=13h (video-bios function) deals length of string in cx . "pascal-string" has length in first byte. has no termination character dos-/c-/asciiz-string. can tp manuals - programmer's guide - here . look @ example: program string_out; var s1 : string; procedure write_local_string; var s3 : string; begin s3 := 'hello world stack segment.'; asm push bp { `bp` in need of proced

c++ - How to Create Thread-Safe Buffers / POD? -

my problem quite common suppose, drives me crazy: i have multi-threaded application 5 threads. 4 of these threads job, network communication , local file system access, , write output data structure of form: struct buffer { std::vector<std::string> lines; bool has_been_modified; } the 5th thread prints these buffer/structures screen: buffer buf1, buf2, buf3, buf4; ... if ( buf1.has_been_modified || buf2.has_been_modified || buf3.has_been_modified || buf4.has_been_modified ) { redraw_screen_from_buffers(); } how protect buffers being overwritten while either being read or written to? i can't find proper solution, although think has quiet common problem. thanks. you should use mutex. mutex class std::mutex . c++11 can use std::lock_guard<std::mutex> encapsulate mutex using raii. change buffer struct to struct buffer { std::vector<std::string> lines; bool has_been_modified; std::mutex mutex; }

c# - Is there a simple way to authenticate WPF Desktop application with Office 365 API? -

i want create simple wpf desktop or console application retrieves , shows data office 365 contacts api. i have azure ad , office 365 accounts. i've read documentation , seen lot of samples. asp.net , windows 8.1 , other types of application. used owin or build-in authentication calls(for windows 8.1). i think should this: user presses button my application calls method "some microsoft library" , passes client_id parameter. call open new browser window suggestion user login. user logs in , agrees provide access contacts. as result of call should receive access token be happy , read contacts using microsoft.ofiice365.outlookservices. i'm stuck @ second point of idea - "some microsoft library". can suggest library should use? exist? if not work in way, can suggest other way retrieve contacts office 365 in wpf desktop or console application? i'm trying find like this, works wiht contacts api (not 1 drive) , not require me define specia

html - What STYLES are allowed inside SPAN? -

the "style" of span applies until /span. but not apply attributes (e.g., background-color). which attributes don't work? is quality looking called "deprecate"? is background-color? is there substitute "background-color" work? thank you! ps - found complete (?) index of attributes (it not have "background-color" - although has "bgcolor" (which "deprecates")). <p>gdh2 no style</p> <p style="background-color:red; color:white; font-size:140%; font-family:verdana; text-align:center"> gdh2 p style = bg color, font color, verdana, centered</p> </span> <span style="color:red; "> <p>gdh2 - inside span font color red = works</p> </span> <span style="font-size:140%; "> <p>gdh2 - inside span font size 140% = works</p> </span> <span style="

ms access - Unbound textbox compared to value in table, Datatype mismatch? -

i working on project class building database in ms access , using bit of sql , vb first time. attempting include login feature project. my form uses code on button labelled "login" take in input user in unbound textboxes, named txtemployeeid , txtpassword, , compare them values in table employee_t, named employeeid , employeepw. employeeid integer value while employeepw string. private sub command1_click() if isnull(me.txtemployeeid) msgbox "please enter employeeid", vbinformation, "employeeid required" me.txtemployeeid.setfocus elseif isnull(me.txtpassword) msgbox "please enter password", vbinformation, "password required" me.txtpassword.setfocus else if (isnull(dlookup("employeeid", "employee_t", "employeeid = ' & me.txtemployeeid.value & ' "))) or _ (isnull(dlookup("employeepw", "employee_t", &quo

pattern matching - How can I assign a reference cell in a function and then return the value in sml -

so have function in sml takes integer value , refs it. how can assign new value variable balance , return balance? in deposit , withdraw patterns? datatype message = getbalance | deposit of int | withdraw of int; fun opening_account init_amt = let val balance = ref init_amt in fn getbalance => !balance | deposit x => balance = !balance + x | withdraw x => balance = !balance - x end; to update reference cell, use := . i.e.: balance := !balance + x if wish both update balance, , return new value, 1 after other ; : (balance := !balance + x; !balance)

networking - Change Response from HTTP Request sent by a program -

i have program activate chip racing results. (its piece of hardware). watch fiddler (sniffing program) in , outgoing traffic pc when connect chip computer. the program sends following http request: post http://example.com/index.php http/1.1 accept: */* accept-encoding: gzip, deflate connection: keep-alive content-length: 185 content-type: application/x-www-form-urlencoded host: example.com pragma: no-cache user-agent: someprogram 1.2.3 data==%0d%0aajlfneew-somelongsecretkey-rgaw%3d%3d%0d%0a i receive following response: <?xml version="1.0" encoding="utf-8"?> <message type="3" result="1" txid="someid" activationdate="" availablecredits="732" firstname="john" lastname="doe" email="johndoe@outlook.com" phonenumber="00123445" notification_email="1" notification_text="1"/> is possible edit response when programs check availablecredits

Save mysql query results to HTML file in PHP -

i want save 20-30 mysql query results .html files separately. $query = mysqli_query($link, "select....") while ($t = mysqli_fetch_assocc($query)) { // other queries , html content** <- want save these. } so want save result, not source code, think should execute , script save html, because in future want open it. you can use file_put_contents or fwrite

node.js - Why am I having trouble installing npm modules? -

i want install react-native-cli module haven't been able so, or other module. i'm trying following: npm install -g react-native-cli what happens terminal processes instruction, yields error. i've used node in windows few days , have been able install successfully, maybe because mac newbie going wrong. i've wondered if node installed. in terminal if write "node" cursor changes $ >, guess it's sign. can things such as: node >console.log('hello world!'); and working perfectly. if do: node >--version it doesn't work. so node installed? doing wrong? try this sudo npm install -g react-native-cli to check version use node --version thanks

jquery - Get value from html form to Javascript variable -

i have been searching issues while can't find solution helps me, maybe i'm stupid @ javascript don't kow. problem title says. i have countdown timer found here on stackoverflow, , written in javascript. not @ javascript (i'm totally newb in it). asking javascript pro me out. i want make simple html form set "var target = 14;" value can be. have no idea pass through form in admin system. the core code: if (document.getelementbyid('countdowntimer')) { pad = function(n, len) { // leading 0's var s = n.tostring(); return (new array( (len - s.length + 1) ).join('0')) + s;};var timerrunning = setinterval( function countdown() { var = new date(); var target = 14; // 15:00hrs cut-off point if (now.getday() == 0) { // sunday - use tomorrow's cutoff target += 24; } else if (now.getday() == 6) { // saturday - use cutoff 2 days target += 48; } else if (now.gethours() < target) { // missed cutoff po

java - Copy Elements From Stack to Queue -

i'm supposed copy elements stack queue. i haven't been able think of way keep stack way , still copy elements queue. i ended method removes elements stack , adds them queue: public void copyfromstack(){ e t; int c = w.size(); while(c != 0){ t = w.pop(); enqueue(t); c--; }} trying push elements not option because it'll backwards. edit: class contains method queue class: public class queue<e> { protected int size; protected node<e> head; protected node<e> tail; nodestack<e> w = new nodestack<e>(); nodestack<e> w2 = new nodestack<e>(); public queue(){ size = 0; head = tail = null;} public boolean isempty(){ return size==0;} public void enqueue(e elem) { node<e> node = new node<e>(); node.setelement(elem); node.setnext(null); if (size == 0) head = node; else tail.setnext(node); tail = node; size++; } public e dequeue() { if (size == 0) system.out.print("queue empty."); e tmp

sql server - What is the name of a table that joins two other tables? -

this question has answer here: is there official name many-to-many relationship table in database schema? 10 answers what name database entity joins 2 other entities using composite keys? i'm asking need write theoretical definition such tables not find definition online. that's associative entity. think comes ordinary object orientation association relationship between 2 different objects, driver , car. see more @ http://en.wikipedia.org/wiki/associative_entity

css - D3 Elements are invisible despite existing in DOM -

i have bootstrap tab panel , want display different d3 chart each tab. when document loads, first d3 chart present in dom elements invisible. here's example: http://i.imgur.com/7attyhi.png here setup tab pane in bootstrap: <div role="tabpanel"> <!-- nav tabs --> <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"><a href="#ghg-co2" aria-controls="ghg-co2" role="tab" data-toggle="tab"> <h4>change in co<sub>2</sub></h4></a> </li> <li role="presentation"><a href="#ghg-ch4" aria-controls="ghg-ch4" role="tab" data-toggle="tab"> <h4>change in ch4 (methane)</h4></a> </li> <li role="presentation"

.htaccess - Hide php page name of header function in url -

i'm trying hide php page name in url redirects after login header function. far can hide index file can't hide file redirects after login. here codes, php script after login events $sql_login = mysql_query("select * sms_people username='$username' , password='$password'"); $row = mysql_fetch_array($sql_login); if ($row > 0 && $row[5] == 1) { header('location: adminpanel.php'); } .htaccess rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewriterule ^(.*)$ $1.php [l] how can hide files redirects header function using .htaccess file? need badly. tnx. there alternative way redirect php files , hide them for example http://yourwebsite.com/user/login/ user part main user.php or can change file name firstl, in htaccess redirect index php rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d ############### seo ########################## rewri

go map, key is string, value is pointer to a struct -

type country struct { code string name string } var store = map[string]*country{} in go code piece, key string, value pointer struct. what's benefit use pointer of contry here? can remove "*" , achieve same behaviour? such as: var store = map[string]country thanks. you can achieve same behavior using either pointer or value. package main import ( "fmt" ) type country struct { code string name string } func main() { var store = make(map[string]*country) var store2 = make(map[string]country) c1 := country{"us", "united states"} store["country1"] = &c1 store2["country1"] = c1 fmt.println(store["country1"].name) // prints "united states" fmt.println(store2["country1"].name) // prints "united states" } using pointer store address of struct in map instead of copy of entire struct. small structs in example

python - scapy sniff only sniffing my pc's data -

i new scapy , trying out code seem having problem, not sure if code or pc code looks : from scapy.all import * def callback(pkt): if pkt.haslayer(tcp): print pkt.summary() print pkt.show() print pkt[tcp] # equivalent to: print pkt.getlayer(tcp) sniff(filter='port 80', prn=callback, store=0) but when run script seem catching traffic computers ip , there way catch traffic on wifi router scapy ? possibly. during normal operations, scapy (or packet monitoring program) can see data going or computer on. there ways of re-routing information go through computer, that's discussion. can use packet monitoring program monitor data on wifi network if , if wireless network card's chipset (or driver) allows enter "monitor" or "rfmon" mode. here webpage seems want. again, works if can switch montior/rfmon mode first. good luck!