Posts

Showing posts from February, 2012

javascript - Using collection helpers in meteor tabular -

i'm displaying table data using meteor aldeed:tabular the tabular initialization code simple: this.tabulartables.customers = new tabular.table({ name: "clients", collection: this.customers, columns: [ {data: "lastname", title: "name"}, {data: "mymessage()", title: "message"} ], }); first field, lastname works perfectly, adding second field mymessage() causes problem i installed dburles:collection-helpers extension , add helper in common code section: this.customers = new mongo.collection("customers"); this.customers.helpers({ mymessage: function () { return "hi!"; } }); but still getting error on client side: exception tracker recompute function: debug.js:41 typeerror: a[i[j]] not function @ c (jquery.datatables.min.js:16) @ jquery.datatables.min.js:17 what might problem helper function , should declare it? i've done more or less ha

debian - Munin-graph is not executing -

i have headless debian box arm v5. linux nsa325 3.13.1-kirkwood-tld-2 #1 preempt tue feb 4 03:19:07 pst 2014 armv5tel gnu/linux i have munin , munin-node configured on box apache. version: 2.0.6-4+deb7u2 one day upgraded munin , default's generate graphs on cgi. such little resources available don't want them generated on fly via old cron method, configured before. updated munin.conf setting graph_strategy cron. restarted services etc , waited graphs. there no graphs. looking in log directory files updated munin-html.log munin-limits.log munin-node.log munin-update.log. no munin-graph.log so executed munin-graph manually munin user; generated graphs , log. so why munin-graph not executing munin-html etc is? --update ran munin-cron munin user , found munin-html outputting error, stopping munin-graph. so question no why munin-html generating issue html::template->new() : cannot open included file partial/navigation.tmpl : file not found. @ /usr/share/perl5/h

php - Number sequence generated IDs - Efficient way to my possible worst scenario -

my setup: mysql , php system scenario: i have more 10 type of system users: example :customer , employee everytime customer or employee added system, system automatically generate id each user based on current date. ex (customer): today june 20,2015 , customer 3rd sign up. id 06202015-03 . everytime user (any type of user) signup sequence number increment 1 in day basis only. every next day sequence counter 0. general question: given concern of id generation solved, practice pre-process next sequence #? mean system pullout next sequence number saved on db table? or should process next sequence number until new user signing up? update (added best possible scenario) : example date: june 20,2015 customer 1 signup = generated id 06202015-01 customer 2 signup = generated id 06202015-02 and on... worst possible scenario during signup: 2 or more user signing simoltaneously if customer1 deleted (by admin) on same day , customer2 signed up,

c# - Form Post Not working While Submission -

whenever try post form following error: an error occurred while getting provider information database. can caused entity framework using incorrect connection string. check inner exceptions details , ensure connection string correct. public class contactcontroller : controller { [httpget] public actionresult index() { return view(new contactmessage()); } [httppost] public actionresult index(contactmessage post) { if(modelstate.isvalid) { //save database using (var db=new contactmvc.data.contactdatabase()) { post.datesent = datetime.now; db.contactmessages.add(post); db.savechanges(); } //redirect tempdata["contactmessage"] = post; return redirecttoaction("sucessfulmessage"); } return view(post); } public actionresult sucessfulmessage() {

ios - Multiline UIButton autosize per line -

Image
i want use standard uibutton text want put on uibutton has... ... multiple lines (each line different string) , ... ... each line should have different font , size ... ... automatically resizes font fit button width (not height make bit easier) so, tough set (preferred) font size each line, want font-size automatically size down each separate line fits nicely in uibutton (=same behaviour uilabel autoshrink / minimum font scale). what don't want: i not want start adding uilabels uibutton (as subview example) or using ib put uilabels on scene , draw uibutton around (why: want standard uibutton highlighting behaviour) what want: a clean solution using attributed string, given width scales down font (updates attributed string guess), line-by-line if required. my idea, implement function this: func addtoattributedstring(attstring : nsmutableattributedstring, plainstring : string, font : uifont, preferredsize : cgfloat, maxwidth : cgfloat) and make

c# - How do change field length with arcobject -

i want change string field in sdegeodatabse bellow code. code running without problem. after running, filed length return default length. missing? static void writetablecode(idataset dataset) { itable table = dataset itable; ifieldsedit fields = table.fields ifieldsedit; (int = 0; < fields.fieldcount; i++) { ifieldedit field = fields.field[i] ifieldedit; if (field.type==esrifieldtype.esrifieldtypestring & field.length<30 ) { field.length_2 = 30; } } } it not possible edit length of field, way achieve create new field, copy data new field. http://support.esri.com/de/knowledgebase/techarticles/detail/42783 ifieldedit shouldn't used change existing fields anyway. api reference: the ifieldedit interface used when creating new fields. should not use modify fields, purpose use iclassschemaedit. i

javascript - Matching the character but not including that character and everything after -

before says it's duplicate of this or this . javascript doesn't have look behind i've been struggling this. have look ahead mentioned here what want this. have :- hey:blah,{'some':'obj','another':[4,5,0]} i want extract after not including first : . output be:- blah,{'some':'obj','another':[4,5,0]} my attempt far:- (:.+) //gives :blah,{'some':'obj','another':[4,5,0]} - note has : [^\w:].+ //gives ,{'some':'obj','another':[4,5,0]} - not result expected. blah missing. i'm trying in pure regex , trying avoid looping or string manipulation of sort. attempt has been no avail far. ^[^:]*:(.*$) you can try this.grab group 1 .see demo. https://regex101.com/r/vh0in5/1

php - How to create a table for a table in phpmyadmin? -

i having hard time thinking how create or have table/s members going join table room. have 2 kind of members holder - 1 creates room member - 1 join room room_code . how can create table members in room? table members : member_id member_type member_name member_username member_password table room : room_id room_name room_code room_section room_desc room_holder_id room_limit date_created the design of table going depend lot on requirements need fulfilled. in situation member can ever assigned single room , room s can have many member s, answer double h gave you're looking for: create table members ( member_id int, member_type varchar, member_name varchar, member_username varchar, member_password varchar, room_id int foreign key references room(room_id) ) now, if member participate in more single room, , rooms can have more single member , start getting off other types of relationships (e.g. many-to-many). the mysql document

amazon web services - Can't Git Push onto AWS EC2 -

i've followed this blog post set remote git repo on our aws ec2 instance. eventhough followed blog post , set rsa public & private keys on local machine , added public key remote aws ec2 server .ssh/authorised_keys not ssh rsa key. following error (i tried both public & private key). $ ssh -i ~/.ssh/id_rsa_aws.pub ubuntu@5?.???.???.?4 agent admitted failure sign using key. permission denied (publickey). $ ssh -i ~/.ssh/id_rsa_aws ubuntu@5?.???.???.?4 agent admitted failure sign using key. permission denied (publickey). i continued setting git per blog post in hope git clone, pull & push abble ssh aws pem key. i wrong , git push requires rsa key. now error when try git push: $ git push origin project-qa agent admitted failure sign using key. total 0 (delta 0), reused 0 (delta 0) fatal: unable create '/var/git/project.git/refs/heads/project-qa.lock': permission denied fatal: remote end hung unexpectedly fatal: remote end hung unexpectedly any

osx - rounded corners on NSView using NSBezierPath are drawn badly -

Image
in viewcontroller's main nsview, override func drawrect(dirtyrect: nsrect) method implement rounded corners on main view using nsbezierpath . in same method designate gradient background of main view. override func drawrect(dirtyrect: nsrect) { let path: nsbezierpath = nsbezierpath(roundedrect: self.bounds, xradius: 18.0, yradius: 18.0) path.addclip() let gradient = nsgradient(startingcolor: nscolor(hexcolorcode: "#383838"), endingcolor: nscolor(hexcolorcode: "#222222")) gradient.drawinrect(self.frame, angle: 90) } the problem arises illustrated in following image: the image shows 1 of views corners. rounding of corners partially successful, there still remains white corner sticking out beyond window's rounded corners. if has better method of setting window's corner radius open such suggestions. have done lot of research on matter, solution appears simplest. any advice on how fix issue appreciated. you should fo

sails.js - sails js - create seo friendly url -

i have created sails js appication. want create seo friendly url application. there plugins sails js create seo friendly url or should create them manually? in sails.js, can set routes (assuming you're setting blog app) 'get /articles/:title': { controller: articlescontroller } and inside articlescontroller , can have function creates url slugs blog post title (something speakingurl ). save in models/articles.js in post-title field. now, everytime wants visit example.com/articles/how-to-get-cats-to-like-you , automatically fetch relevant article.

opengl - Runtime error with GLSL shaders: Inconsistency detected by ld.so -

i writing opengl code draw small dot in window, when try use own shaders, error message don't understand. so, here's main function: int main(int argc, char** argv) { // initialize things glutinit(&argc, argv); glutinitdisplaymode(glut_double | glut_rgba); glutinitwindowsize(100, 100); glutcreatewindow("opengl test"); glutdisplayfunc(renderscene); glewinit(); glclearcolor(0.0f, 0.0f, 0.0f, 0.0f); // make vertex buffer vector3f vertices[1]; vertices[0] = vector3f(0.0f, 0.0f, 0.0f); glgenbuffers(1, &vertex_buffer); glbindbuffer(gl_array_buffer, vertex_buffer); glbufferdata(gl_array_buffer, sizeof(vertices), vertices, gl_static_draw); // main glut loop glutmainloop(); } and here's rendering callback function: static void renderscene() { glclear(gl_color_buffer_bit); glenablevertexattribarray(0); glbindbuffer(gl_array_buffer, vertex_buffer); glvertexattribpointer(0, 3,

ios - The world of generated NSManagedObjects and a Superclass -

i have several generated nsmanagedobject subclasses. using article created parent class (named qualifier) nsmanagedobject subclasses extend. in way can have class hierarchy without entity hierarchy. i have problem won't know until runtime subclass need create. have string representing class name. put method in qualifier class creates specific subclass: + (instancetype) insertnewobjectfor:(nsstring *) qualifiername intocontext:(nsmanagedobjectcontext *) managedobjectcontext { nsmanagedobjectmodel *managedobjectmodel = [[managedobjectcontext persistentstorecoordinator] managedobjectmodel]; class qualifierclass = nsclassfromstring(qualifiername); nsentitydescription *entity = [[managedobjectmodel entitiesbyname] objectforkey:qualifiername]; qualifier *object = [[qualifierclass alloc] initwithentity:entity insertintomanagedobjectcontext:managedobjectcontext]; return(object); } i'm new @ objective c , wanted ask more informed stack exchangers if acc

ios - ViewController Type does not have member named -

i searched similar questions none seemed answer issue. making single view app. in class viewcontroller: uiviewcontroller section have following code: var lasttoact = 0 var gamestarted = false var tempplayer = baseplayer() var positionnumber : int = 0 var stringposnum : string = string(positionnumber) var stringfrominteger : string = "\(string(positionnumber))" the first 5 variables no error 6th , 7th ones viewcontroller type' not have member named' positionnumber last 2 variables. don't know why is. var stringposnum : string = string(positionnumber) the problem stored instance variable default value depends on value of another instance variable. can't that, because @ instantiation time, when default value applied, there no other instance variables, because there no instance yet — instance in middle of creating. one solution: put lazy in front of declaration. solution: if variable have relation other instance variable, make compu

ruby - Using a has_many association with a single table inheritance model in rails -

i'm trying create simple has_many association between game , dlc models. challenge i'm facing since there's no dlc table because of single table inheritance, there's no way insert game_id . if following i'd error: game = game.create game.dlcs sqlite3::sqlexception: no such column: games.game_id here how models setup: class game < activerecord::base has_many :dlcs end class dlc < game belongs_to :game end note: dlc refers downloadable content the simplest alternative use self-joins , add parent_id column games . class game < activerecord::base has_many :dlcs unless self.name == 'dlc' end class dlc < game belongs_to :game, foreign_key: :parent_id end if that's absolutely unthinkable can create join table. # game_id: int # dlc_id: int class gameextension belongs_to :game belongs_to :dlc end class game < activerecord::base has_many :game_extensions has_many :dlcs, though: :gameextension

maven - HttpClientBuilder - java.lang.NoSuchFieldError: INSTANCE -

Image
i have maven java project uses httpclient execute http requests. on local java web server works fine. after deploy sap hana cloud platform following error: java.lang.nosuchfielderror: instance @ org.apache.http.impl.io.defaulthttprequestwriterfactory.<init>(defaulthttprequestwriterfactory.java:52) @ org.apache.http.impl.io.defaulthttprequestwriterfactory.<init>(defaulthttprequestwriterfactory.java:56) @ org.apache.http.impl.io.defaulthttprequestwriterfactory.<clinit>(defaulthttprequestwriterfactory.java:46) @ org.apache.http.impl.conn.managedhttpclientconnectionfactory.<init>(managedhttpclientconnectionfactory.java:72) @ org.apache.http.impl.conn.managedhttpclientconnectionfactory.<init>(managedhttpclientconnectionfactory.java:84) @ org.apache.http.impl.conn.managedhttpclientconnectionfactory.<clinit>(managedhttpclientconnectionfactory.java:59) @ org.apache.http.impl.conn.poolinghttpclientconnectionmanager$internalconnectionfactory.<init>

c - Add Array Program Not Working -

i learning c , went on pointers section. book asked write program adds 2 arrays 1 array passing pointer function. went through code , looks ok me, reason output produces mixed results. can 1 tell me if looks wrong. // // main.c #include <stdio.h> #include <unistd.h> int *addarrays(int *a, int *b, int a, int b); int main(void) { int a[5] = {1,2,3,4,5}; int b[7] = {6,7,8,9,10,11,12}; int = 5; int b = 7; int c = + b; int x = 0; int newarray[c], *arrayptr; arrayptr = addarrays(a,b,a,b); for( x = 0; x < c; x++) { *(newarray + x) = *arrayptr; printf("value of newarray[%d] = %d\n", x, *(newarray+x)); sleep(1); arrayptr++; } return 0; } int *addarrays(int *a, int *b, int a, int b) { int c; int d; int newarray[a+b]; (c = 0; c < a; c++) { newarray[c] = *a; a++; } (d = 0; c < d; d++) { newarray[a] = *b;

ios - Saving a Users Data from Scratch -

i have app want user select location first time open app. after select location, want location saved , buttons made available locations. currently, have tried saving user's location, can achieve when in app, however, whenever app closed out old data not load. 2 questions are: -- how save user's location throughout whole app -- way recommended call different links based on user's location? (update): have tried right using nsuserdefaults. here's code. - (void)viewdidload { [super viewdidload]; [self userlocationsave]; } -(void)userlocationsave { campuslocation = self.lbluserlocation.text; self.lbluserlocation.textcolor = [uicolor whitecolor]; [self savedata]; } -(void)savedata { nsstring *savelocation = self.lbluserlocation.text; nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; [defaults setobject:savelocation forkey:@"campuschoice"]; [defaults

javascript - Determine the data type of the HTTP request -

i see $.ajax() can use datatype property tell jquery kind of response expect server, json . but on server side, how know data type requested? i understand server should know send based on content of request, use case bit different here. have error handler built in php , i'd know in format output debug info. in case of fatal/syntax errors, warnings, script may not reach request handler function associated request. there's content_type header apparently it's application/x-www-form-urlencoded , , it's sent on post requests. and there's http_accept header looks application/json, text/javascript, */*; q=0.01 . need parse string? there no standard way client tell server data type wanted. clients not tell "i want text/plain" or "only html please" (this can assumed uri). tell can potentially interpret ( http_accept ) , post ( content_type ). for server side error handler reliably determine output format use, pass additional r

android - How to hide header in CalendarView in DatePicker? -

Image
how can hide header on screenshot below? you not it, can forced spinner <datepicker ... android:datepickermode="spinner" /> or create own custom datepicker http://www.mysamplecode.com/2011/10/android-datepickerdialog.html

c++ - Installing FreeGlut 3.0.0 in Netbeans IDE with Cygwin Compiler -

i trying install freeglut , set opengl within netbeans 8.02 ide. using cygwin (gcc/g++) compiler in netbeans. have installed freeglut 3.0.0 don't know how link freeglut libraries cygwin compiler in netbeans. i think have copy , paste bin, lib, , include folders freetglut , merge them bin, lib, , include folders within cygwin folder. im not sure on this. i have multiple comments: it seems free glut isn't compiled. there included make files or cmake files included, build that. if new that, google it. about making sure cygwin links them, suppose approach work, not best. suggest add lib folder link (or library) directories in ide. i'm not familiar net beans, in project settings page. about bin directory, suggest copying contents of output directory .exe way when redistribute program users guaranteed have it.

postgresql - rails db:migrate fails rake aborted ActiveRecord::NoDatabaseError -

on cloud9 ide installed postgresql because needed deploy on heroku, learning not sure, when try migrate simple database table used bundle exec rake db:migrate , rake aborted , activerecord::nodatabaseerror: fatal: role "ubuntu" not exist. postgresql comes preinstalled on cloud9. can't run bundle exec rake db:migrate though, because have set , connect first. refer documentation here https://docs.c9.io/v1.0/docs/setting-up-postgresql on how set up. also, dont need install postgresql able deploy heroku. use rails comes with, sqlite. however, best practice use same database development , production.

Is there a command for batch codes to change to another specific window? -

is possible put command batch file enter text specified window , hit enter key if user interacting it? i know of handy little exe command prompt called "keystuff" capable of changing windows , inserting text, cant find has capability specify window change since utilizes alt+tab change window. you can, sort of -- not entirely reliably, , not pure batch. can use wscript.shell com object both appactivate , sendkeys methods. appactivate let change focus window either pid or title. when focusing window title, match first attempted full title, title beginning, title ending, in order. so, example, if wanted send keystrokes firefox, shellobj.appactivate('firefox') (because firefox tabs end in "mozilla firefox"). unfortunately, there's no easy way specify part of window gets focus. if want sendkeys url bar search bar last focused before window last blurred, keys sent search bar. there's no way around unless simulate keyboard navig

php - Need help writing remove() for global query scope -

here scope, apply() method works wonderfully. use illuminate\database\eloquent\scopeinterface; use illuminate\database\eloquent\builder; use illuminate\database\eloquent\model; use carbon\carbon; class jobstatusscope implements scopeinterface { /** * apply scope on query. * * @param \illuminate\database\eloquent\builder $builder * @param \illuminate\database\eloquent\model $model * @return void */ public function apply(builder $builder, model $model) { $builder ->where('active', true) ->wherehas('user', function($q) { $q->where('account_type', 'company') ->wherenested(function($r) { $r->where('stripe_active', true) ->orwherenotnull('subscription_ends_at') ->where('subscription_ends_at', '>', carbon::now())

vb.net - Format Dynamic Text Using PHP -

i have text fields populated database, text when entered user punctuated correctly full stops , carriage returns etc. using vb ordinary db request: <%=(rsmyrecordset.fields.item("text").value)%> i result: mary had little lamb. fleece white snow. even if user entered return after full stop after word lamb. using code: <%= replace(rsmyrecordset.fields.item("text").value, vbcrlf, "<br>") %> the text returned be: mary had little lamb. fleece white snow. how achieve same result using php? have: <?php echo $row_rsmyrecordset['text']; ?> many thanks maybe looking nl2br: http://php.net/manual/function.nl2br.php <?php echo nl2br($row_rsmyrecordset['text']); ?>

ms access: Enter parameter value -

i trying open form on click of button. below code private sub command17_click() dim stuff string dim salarystatus string stuff = "senior stuff" salarystatus = "deposit" ssql = "select customert.* customert (((customert.[salary status])=" & salarystatus & ") , ((customert.[stuff type])= " & stuff & "));" docmd.openform "clusterf" forms!clusterf.form.recordsource = ssql forms!clusterf.form.requery forms!clusterf.form.refresh end sub when click on button small popup window says enter parameter value stuff , salarystatus . why window shows. wrong sql query , how fix it? yes, reduce little , rename button: private sub command17_click() dim stuff string dim salarystatus string stuff = "senior stuff" salarystatus = "deposit" ssql = "select customert.* customert customert.[salary status] = '" & sal

ios - Link View Controllers to Mirror -

my application has facebook login screen, after login shows profile picture, username, email, , logout button . i trying figure out how link current users profile picture uiview or uiimageview (which ever more applicable, given used uiview called fbprofilepictureview ) in main vc called homeviewcontroller . here code have loginviewcontroller has fb information asked , returned. have segue homeviewcontroller once user info has been entered. loginviewcontroller.h: #import <uikit/uikit.h> #import <quartzcore/quartzcore.h> #import <facebooksdk/facebooksdk.h> @interface loginviewcontroller : uiviewcontroller <fbloginviewdelegate> @property (weak, nonatomic) iboutlet fbloginview *loginbutton; @property (weak, nonatomic) iboutlet uilabel *lblloginstatus; @property (weak, nonatomic) iboutlet uilabel *lblusername; @property (weak, nonatomic) iboutlet uilabel *lblemail; @property (weak, nonatomic) iboutlet fbprofilepictureview *profilepicture; @proper

java - No primary SDN label exists .. (i.e one starting with _) -

spring data neo4j version: 3.3.0.release neo4j version: 2.2.2 i ran following exception when tried query default methods exposed on spring-data repository i.e. personrepository.findall(getdefaultpageable()); public static pageable getdefaultpageable() { bifunction<integer, integer, pageable> bifunction = pagerequest::new; // method reference syntax in action return bifunction.apply(default_page_number, default_page_size); } caused by: java.lang.illegalstateexception: no primary sdn label exists .. (i.e 1 starting _) @ org.springframework.data.neo4j.support.typerepresentation.labelbasednodetyperepresentationstrategy.readaliasfrom(labelbasednodetyperepresentationstrategy.java:136) @ org.springframework.data.neo4j.support.typerepresentation.labelbasednodetyperepresentationstrategy.readaliasfrom(labelbasednodetyperepresentationstrategy.java:40) @ org.springframework.data.neo4j.support.mapping.trstypealiasaccessor.readaliasfrom(trstypealiasacc

bash - Escape sequence not working in python script run from a shell script -

i have shell script needs run python script. python script may passed argument. python pgm32.py $args but when argument passed has escape sequence or if encase in quotes, python scripts not recognize it. for instance args contains "open drive" or open\ drive python script's sys.argv=['pgm32.py', '"open', 'drive"'] or sys.argv=['pgm32.py', '"open', 'drive"'] respectively. but when call python script directly command line, , pass argument "open drive" or open\ drive , script's sys.arv=['pgm32.py', 'open drive'] how can fix issue? it's quite simple. quote argument in shell command: $ python pgm32.py "$args" you did yourself: but when call python script directly command line, , pass argument "open drive" or open\ drive, script's sys.arv=['pgm32.py', 'open drive'] which worked because in these

Python: extracting text from strings using a key phrase -

struggling trying find way this, great. i have long string – it’s title field. here samples. air-lap1142n-a-k air-lp142n-a-k used airo 802.11n draft 2.0 singleaccess point air-lp142n-a-9 airo air-ap142n-a-k9 ios ver 15.2 mint lot of (2) air-la112n-a-k9 - dual-band-based 802.11a/g/n genuine airo 112n ap air-lp114n-a-k9 poe wireless ap air-lp114n-a-9 airy 50 availiable i need pull part number out of title , assign variable named ‘partnumber’. part number start characters ‘air-‘. so example- title = ‘air-lap1142n-a-k9 w/power cord’ partnumber = yourformula(title) print (partnumber) output air-lap1142n-a-k9 i new python , appreciate help. print part number not other text before or after. def yourfunction(title): word in title.split(): if word.startswith('air-'): return word >>> partnumber = yourfunction(title) >>> print partnumber air-lap1142n-a-k9

Jquery Json parser showing invalid character error for jersey rest webservice response -

i'm creating json rest webservice mediatype property @get @produces(mediatype.application_json) public issues getallopenpoints() { i'm using jackson jars creating json response. not creating json manually still when trying parse response jquery. throws invalid characher error. $.parsejson(result); do need encode or escape data in objects before returning rest webservice. whats point of using auto response conversion jackson. i believe know problem in json parsing still looking reason. problem due structure of object graph have. first designed xml manually. then generated schema xml then used eclipse create java objects xsd. below xml started with.. <issues> <issue> <product>xxxx</product> <datereported>xxxx</datereported> <summary>xxxx</summary> <status>xxxx</status> <responsibleperson>xxxx </responsibleperson> <targetcompletiondate>xxxx</tar

Google Sheets Custom Gauge Chart -

Image
is possible use cell value min/max values within gauge chart? @ moment if set value other integer value gets cleared sec move away input field. i've looked other customization options documentation coding custom values charts seems when using draw api on custom app or webpage. in instance i'm trying customize , embed charts within current working spreadsheet. appreciate or insight community may have cause searching returning null.

c# - How to create chat functionality in ASP.NET 4.0 -

i want develop 1 chat functionality in asp.net website, have 1 registered_user.aspx page , here in page want show registered users online , offline mode, after when select online user chat 1 message should delivered user in form of accept/decline , if user accept chat chat start otherwise chat decline. you can implement want using signalr new library asp.net developers makes incredibly simple add real-time web functionality applications. "real-time web" functionality? it's ability have server-side code push content connected clients happens, in real-time. you'll find tutorial getting started signalr 2 for purpose can establish temporal connection perhaps notification establish persistent one.

javascript - How to set default active element in SlickJS slider -

i have slick slider witch displays elements sorted date , want preselect last 1 (current month) default element. example if have [01 2015, 02 2015, 03 2015, 04 2015, 05 2015, 06 2015] i want display 06 2015 , when swipe backwards older mounts. basically want here set initial slide current month. solution more or less straight forward. executable example right below: $('.myslider').slick({ initialslide: ((new date).getmonth()) }); /* slider */ .slick-slider { position: relative; display: block; -moz-box-sizing: border-box; box-sizing: border-box; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-touch-callout: none; -khtml-user-select: none; -ms-touch-action: pan-y; touch-action: pan-y; -webkit-tap-highlight-color: transparent; } .slick-list { position: relative; display: block;

multithreading - C++/MFC/ATL Thread-Safe String read/write -

i have mfc class threads launched , threads need modify cstring members of main class. i hate mutex locks, there must easier way this. i thinking use boost.org library or atl::atomic or shared_ptr variables. what best method of reading , writting string , thread safe? class myclass { public: void myclass(); static uint mythread(lpvoid parg); cstring m_strinfo; }; void myclass::myclass() { afxbeginthread(mythread, this); cstring strtmp=m_strinfo; // may cause crash } uint myclass::mythread(lpvoid parg) { myclass pclass=(myclass*)pard; pclass->m_strinfo=_t("new value"); // non thread-safe change } according msdn shared_ptr works automatically https://msdn.microsoft.com/en-us/library/bb982026.aspx so better method? #include <memory> class myclass { public: void myclass(); static uint mythread(lpvoid parg); std::shared_ptr<cstring> m_strinfo; // ******** }; void m

.htaccess - htaccess Rewite code for specific pages -

i using rewrite rule in htaccess file: rewriterule ^([\w/-]+)/?$ index.php?page_slug=$1 [l, qsa] how can redirect domain.com/online-shop/ domain.com/online-shop/home same way above? you can have new rule specific page: rewriterule ^(online-shop)/?$ /$1/home [l,nc,r=302] rewritecond %{request_filename} !-d rewriterule ^((?!online-shop/)[\w/-]+)/?$ index.php?page_slug=$1 [l,qsa,nc]

python - Can't find SalesForce Object -

i'm having trouble salesforce, i've never used before i'm not entirely sure going wrong here. using simple_salesforce python module. have pulled data salesforce standard objects, custom object giving me trouble. query result = sf.query("select name call_records__c") which produces error: traceback (most recent call last): file "simple.py", line 15, in <module> result = sf.query("select name call_records__c") file "/usr/local/lib/python2.7/dist-packages/simple_salesforce/api.py", line 276, in query _exception_handler(result) file "/usr/local/lib/python2.7/dist-packages/simple_salesforce/api.py", line 634, in _exception_handler raise exc_cls(result.url, result.status_code, name, response_content) simple_salesforce.api.salesforcemalformedrequest: malformed request https://sandbox.company.com/services/data/v29.0/query/?q=select+name+from+call_records__c. response content: [{u'errorcode&#

swift - Making UITableViewCell a square based on screen width -

i have table view controller displaying square videos, , want each table view cell square well. possible have each uitableviewcell dynamically resize according width of screen (for example 320x320 iphone5 , 375x375 iphone6)? in view controller's viewdidload function have: framewidth = self.view.frame.size.width self.videosview.rowheight = uitableviewautomaticdimension self.videosview.estimatedrowheight = framewidth the constraints view displays video inside uitableviewcell are: leading , trailing space superview, top space superview, 1:1 aspect ratio i still can't cell square though. appreciated! there reason hard do. cells inside uitableview reused can allocated once. (for performance) resizing view performance wise costly, that's way put 1 number height of cell. what can have if statement , return accordingly phone version.

php - allow custom modules in fuel CMS -

firstly; know documentation touches this, find documentation tricky read (as starting ci) i read allow new custom module ; need add module folder ' modules allowed ' array. below commented out in my_fuel.php so, since read referenced in my_fuel.php // uncomment if want control fuel settings in cms. below couple examples of ones can configure $config['settings'] = array(); $config['settings']['site_name'] = array(); if (!empty($config['modules_allowed'])) { $config['settings']['modules_allowed'] = array('blog' 'type' => 'multi', 'options' => array_combine($config['modules_allowed'], $config['modules_allowed'])); } so, uncommented out; , added ' blog ' right @ start of array( defined -- did not work! in fuel cms there 2 types of modules: simple & advanced . simple module data model can add site expose form fields in cms admin. advanced modul

php - Previous and next month not working as expected -

i have following code in order create previous , next month links: $date = mktime( 0, 0, 0, date("m"), 1, date("y") ); $nextmonth = strftime( '%b', strtotime( '+1 month', $date ) ); $prevmonth = strftime( '%b', strtotime( '-1 month', $date ) ); $nextyear = strftime( '%y', strtotime( '+1 month', $date ) ); $prevyear = strftime( '%y', strtotime( '-1 month', $date ) ); now when december next year variable 2016 previous year variable 2015 but when date january 2016 next year variable 2015 previous year variable 2014 i can't understand why doing or doing wrong here. 1 have idea how fix this? testing function fixed parameters, you'll : $date = mktime( 0, 0, 0, 1, 1, 2016); and echo $nextyear not give 2016 because added 1 month. testing what's scripted : the next year variable 2016 // january 2016 + 1 month = february 2016 previous year variable 2015 // jan

c# - Windows phone 8.1 network connectivity -

when in star bucks or other additional user action required wifi places, phone connected wifi , not network. web browser pops asking credentials or accept terms , conditions. in windows phone 8.1 there api's check if phone connected network? know there apis check internet profiles. how know if network available ? this edge case scenario user might close browser without accepting terms , conditions. time wifi still connected. any work arounds ?

c - Char array of array values to pointer array -

i need put array of array chat values in pointer array. first used code , works me. char *current_tag_lists[20]; char current_tag_list1[]="0005808897"; char current_tag_list2[]="0009953997"; char current_tag_list3[]="0000116600"; current_tag_lists[0] = current_tag_list1; current_tag_lists[1] = current_tag_list2; current_tag_lists[2] = current_tag_list3; so can access value index current_tag_lists[0] . but actual requirement add these value in run time follows. example code. char *current_tag_lists[20]; while(k<6) { char rfid_input_characters[12]; while(a<13){ if(a==12){ current_tag_lists[k]=rfid_input_characters; a=0; k++; break; } else{ rfid_input_characters[a]='a'; // example in code value a++; } } } but problem "current_tag_lists" not store values. store current value. every time replace previous