Posts

Showing posts from March, 2015

c++ - Possible Code Speed Optimisations? -

ok have trig class use store static table of values faster execution of sin, cos, , tan functions in program. there comments and/or speed improvements made on current method? previous answers, feeling more competent c++. trig.h #pragma once #include <math.h> class trig { private: struct table { static const int multiple = 10; // accurately stores values 1/10 of degree double sin[360*multiple]; table(); }; static const table table; static void shrinkrange(double*); // shrinks degrees range 0-359 proper array indexing public: static double sin(double); static double cos(double); static double tan(double); }; trig.cpp #include "trig.h" trig::table::table() // table constructor { double const pi = 3.14159265358979323; double const degtorad = pi/180.0; double const incr = 1.0/multiple; int index = 0; (double angle = 0; index != 360*table.multiple; angle += incr) table::sin[index...

ios - Add TabBArController to the UIView -

adding tab bar controller uiview [self.view addsubview:tabbarcontroller.view] ; not loaded content view controllers view, while selecting tab bar items crashed. when set tab bar controller root view controller working fine. how set tab bar controller uiview can set view other purpose iad? you create 1 tabbar controller in app delegate don't add window, , in view controller have add these: gobjappdelegate.tabbarcontroller = [[uitabbarcontroller alloc] init]; gobjappdelegate.tabbarcontroller.viewcontrollers = @[viewcontroller1, viewcontroller2]; [gobjappdelegate.tabbarcontroller setselectedindex:0]; [self.navigationcontroller pushviewcontroller:gobjappdelegate.tabbarcontroller animated:yes]; gobjappdelegate shared singleton instance of app delegate.this way worked me.

javascript - getElementById().value Returning Undefined -

i'm writing simple code change visibility of image when button clicked, document.getelementbyid().value coming undefined . (i've tried replacing .value .display - same result). what problem? <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <script> function hideimage(imageid){ document.getelementbyid(imageid).visibility="hidden"; } function showimage(imageid){ document.getelementbyid(imageid).visibility="visible"; } function switchvis(imageid){ var curvis = document.getelementbyid(imageid).value; if(document.getelementbyid(imageid).value=="hidden"){ document.getelementbyid("output").innerhtml="hidden"; showimage(imageid); } else if(document.getelementbyid(imageid).value=="visible"){ hid...

c# - Retrieve Data from Repeater item -

i have following repeater: <asp:repeater id="rptleaverequests" runat="server" onitemdatabound="rptleaverequests_itemdatabound"> <itemtemplate> <table id="tableitem" runat="server"> <tr> <td style="width: 100px;"> <asp:label id="lbldate" runat="server" text='<%#eval("date", "{0:dd/m/yyyy}") %>'></asp:label> </td> <td style="width: 100px;"> <asp:label id="lblhours" runat="server" text='<%#eval("hours") %>'></asp:label> </td> <td style="width: 200px;"> <asp:label id="lblperiod" runat="server" text='<%#eval("amorpm") %>'><...

javascript - Wordpress Theme Uncaught TypeError -

my website working fine until other day. don't know what's happened dropdown system has stopped working - admin bar. when open javascript console in google chrome when i'm on site homepage ( http://thejailbreaker.co.uk ), message each dropdown item: uncaught typeerror: object #<object> has no method 'on'... i don't know how fix this, i've looked everywhere. in themes "header.php" file? if so, abouts? can upload php code here if willing me. thanks in advance! i found problem! wen plugins section of wordpress , disabled "likelocker". problem is, i've got go plugins code , try figure out haha. thank anyway!

c# - How to retrieve one record at a time from SQL Server database in MVC Model -

i working on visual c# mvc project. using ef databse first approach in model.my project developing appmarket users can buy apps. used partial view in home page contain details of different apps in different partial views.like app1 in 1st partial view, app2 in 2nd partial view, on. used each loop. in each partial view there link called moreinfo, when user clicks on go inside moreinfo page. in database have fields such app info, app cost, description etc displayed inside moreinfo page. these fields in 1 table called apps table. when follow enumerable.firstordefault approach able retrieve first record database. problem need retrieve first record in first moreinfo view, second record in second moreinfo view , on. my code controller : public actionresult moreinfo() { var e = enumerable.firstordefault(db.appmarketapps); return view(e); } and in view used : @model market.models.appmarketapp <h3><span class="grey"><a href="#">...

android - listAdapter in SherlockListFragment -

i want set listview, want activity among sherlock tabs. here code public class playlistactivity extends sherlocklistfragment{ // songs list public arraylist<hashmap<string, string>> songslist = new arraylist<hashmap<string, string>>(); @override public sherlockfragmentactivity getsherlockactivity() { return super.getsherlockactivity(); } @override public void onviewcreated(view view, bundle savedinstancestate) { super.onviewcreated(view, savedinstancestate); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // view fragmenttab3.xml view view = inflater.inflate(r.layout.playlist, container, false); arraylist<hashmap<string, string>> songslistdata = new arraylist<hashmap<string, string>>(); songsmanager plm = new songsmanager(); // songs sdcard this.song...

javascript - New forms - embedding a collection of forms - Symfony2 -

i'm doing same explained here: http://symfony.com/doc/current/cookbook/form/form_collections.html but in case want add new "tags" not manually clicking on link, automatically. give template array items , each of items want add new form - number of items should equal number of forms. if it's possible, i'd prefer solution this: {% in items %} {{ i.name }} {{ form_widget(form.tags[loop.index0].name) }} {% endfor %} but how automatically create objects in controller, too? tells me there no obeject index=1, , yes - there isn't, isn't there way create them automatically , not need create example 10 empty objects of same kind in controller? :( another thing thinking this: {% in items %} <ul class="orders" data-prototype="{{ form_widget(form.orders.vars.prototype)|e }}"> {{ i.name }} , here should field form, example tag.name </ul> {% endfor %} i suggest js given in cookbook should changed this, i...

jquery - DropDownList with Textbox in MVC4 razor -

Image
i need dropdownlist textbox under dropdownlist. requirement there not overlap dropdown list on bottom text box. when click dropdown list automatically adjust height following image. have problem getting when select dropdown list point of time overlap bottom textbox. have using asp.net mvc4 razor there jquery control please me i think show this you use bootstrap's select2 plugin . allows filter results dropdown typing text input field:

iphone - Data is not coming to Annotation method in ios -

how send data -(mkannotationview *)mapview:(mkmapview *)mv viewforannotation: (id <mkannotation>)annotation { method. once please observe code , give me solution. -(mkannotationview *)mapview:(mkmapview *)mv viewforannotation: (id <mkannotation>)annotation { static nsstring *defaultpinid = @"com.invasivecode.pin"; mkannotationview *pinview =(mkannotationview *)[mapview dequeuereusableannotationviewwithidentifier:defaultpinid]; nslog(@"pindata....%@",pinview); if (pinview == nil){ pinview = [[mkannotationview alloc]initwithannotation:annotation reuseidentifier:defaultpinid]; pinview.canshowcallout = yes; pinview.enabled = yes; pinview.rightcalloutaccessoryview = [uibutton buttonwithtype:uibuttontypedetaildisclosure]; [pinview setselected:yes animated:yes]; pinview.image = [uiimage imagenamed:@"location.png"]; } else{ } return pinview; } ...

php - Showing content in tabs but using different content -

Image
so i'm trying create page using tabs. clicking on tab needs show page tab linked ( #tab1 --> tab). got 28 links , name's id ( cat1 --> 0 | cat2 --> 1 etc) clicking on 1 of them opens them , auto include's page ( 'http://services.runescape.com/m=itemdb_rs/api/catalogue/items.json?category='.$cats[0].'&alpha=a&page=1' ) cats[0] cat id sended option menu. because i'm using tab system have no idea how open tab , sending id page , sending tab opened , showing data. tl;dr? click on tab --> sending id external page --> returning data --> posting data tab opened. second part now second part. when data received , posted see 5 results letter "a" there bar above tab content of z. when in tab cat1 can click on b , shows same tab result letter b. currently looks like. clicking on "construction" should open tab construction grabbing data page. , clicking on second letter (should b in future) opens same tab...

css - Jquery DatePicker Conditional Styling -

i'm using jquery datepicker element allows user select months. <style> .ui-datepicker-calendar { display: none; } </style> the above css works fine. i'm passing variable indicates whether user able select months or can select date too. kind of conditional styling. the code goes me now. <head> <link rel="stylesheet" href="styles/jquery-ui.css" /> <script language="javascript" type="text/javascript" src="js/jquery.js" ></script> <script language="javascript" type="text/javascript" src="js/jquery-ui.js"></script> </head> //some code here <label for="mydate">mydate</label> <input type="text" id="mydate" name="mydate" /> //some more code if(//mytest - test if months shown) { $(".ui-datepicker-calendar").css("display",...

php - How to redirect all touch devices to a different site? -

i have created rather complex superscrollorama animation whith few responsive breakpoints well, , works smoothly on screen sizes. however, safari (and such, chrome ios) works bit differently, had use script called iscroll. on mobile page superscrollorama john mentions solution quite resource-heavy , should used smaller stuff. now, animation won't scroll on ipad 4 or iphone 5, guess i'm bit on "smaller stuff" thing. that's sad. wanted able went full responsive. :) however, offer decent solution mobile users too. have index.php main site, , index2.php mobile users. .htaccess files chinese me, can give me help? i'd need following happen: desktop users index.php gives them , url bar shows mydomain.co mobile users index2.php gives them , url bar still shows mydomain.co i had following code , renamed index2.php index.php , put inside /mobile, somehow not work: rewritecond %{request_uri} !^/mobile/.*$ rewritecond %{http_user_agent} "android|bla...

android - Show SQLite data by clicking list item in a list populated by the Database -

i have spent few days trying achieve myself , have experimented many stackoverflow answers close need achieve no avail. i have sqlite database, each row holds holds phrase , translation phrase in foreign language, need display stored phrases in list have done far struggling figure out how 2 things when clicking list item. 2 things displaying foreign translation of clicked list item (phrase) in toast have text speech read out foreign string. here class contains code: public class showphrases extends activity implements oninitlistener{ private sqlitedatabase database; private cursoradapter datasource; private cursor mnotescursor; private notesdbadapter mdbhelper; private texttospeech tts; private static final string fields[] = { "phrase", basecolumns._id };//the phrase shown in list string transalation = "folang";//folang holds translation @override public void oncreate(bundle savedinstancestate) { this.requestwindowfeature(window.feature_no_title); ...

java ee - Importing Ear project generated by gradle in eclipse -

i using gradle set multi-project build. have following folder layout projects: ---rootproject ---- build.gradle ---- settings.gradle ------ jarproject (utility) --------- build.gradle ------ jpaproject (dependency on jarproject) --------- build.gradle ------ ejbproject (dependency on jarproject, jpaproject) --------- build.gradle ------ webproject (dependency on ejbproject) --------- build.gradle tools & technologies gradle: 1.6 java: 1.7 eclipse: juno server: glassfish 3.1.2.2 i able define multi-project build above folder layout. gradle able generate eclipse meta-data each of project able import projects in eclipse. gradle able correctly generate ".ear" artifact. however, unable deploy ear project eclipse. during deployment eclipse gives nullpointerexception. in order tell gradle generate appropriate facet earproject, ejbproject , jpaproject, have added following code: * earproject/build.gradle apply plugin: 'ear' apply plugin: 'eclipse...

converting String to Int in C# -

i have string string w = y + "/" + fromrow[col2.columnname]; and w returns value 0/5 "0/5" , have convert on int32 . tried int.parse , showing error input string not in correct format. string w="0/5" int m=int32.parse(w) i have tried convert.toint32 showing error. string w="0/5" int m=convert.toint32(w) an integer single number no decimal part, e.g., 3, 28, -76, 154, etc. have string, "0/5". "0/5" doesn't represent number (especially you've said it's not fraction), can't converted integer because it's not same kind of data. you'll need change data type of column want store in, or store data in different way (e.g. store 2 integers in separate columns).

asp.net - Update SQL database with session parameter in C# -

i'm looking way update sql server database code-behind in c# session parameter , how sqlcommand in asp: important: sqlcommand in c# in static function going problem ? thanks in advance! <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:spms_dbconnectionstring1 %>" updatecommand="update project set startdate = @startdate, duedate = @duedate, progress = @progress, status = @status (prid = @prid)"> <updateparameters> <asp:sessionparameter name="prid" sessionfield="project" type="string" /> <asp:parameter name="startdate" type="datetime"/> <asp:parameter name="duedate" type="datetime" /> <asp:parameter name="progress" type="int32" /> <asp:parameter name="status" type=...

if statement - If conditions for Python dictionaries -

so have string converted dictionary called test , takes form: {"a":"1","b":"2","c":"3"} now while creating dictionary, availablilty of "c":"3" key-pair, depends on condition; there cases when dictionary reads as: {"a":"1","b":"2"} i have if condition checks existence of "c" key , gives output based on it. condition follows: if (test["c"]): print "hello world!!" this has no else condition. problem arises when 3rd key-value pair isn't in dictionary. running code gives following error: file "test.py", line 14, in test if test["c"]: keyerror: 'c' may know can resolve , correct in code? use in check if key in dictionary: if "c" in test: ...

html - How can i get all list items to be a equal width? -

i want navigation bar equal width each ul element. tried width:100% ul.navbar a , ul.navbar li . jsfiddle: http://jsfiddle.net/heyitsprodigy/a2zvr/ css: @charset "utf-8"; /* elements */ body { margin:0; padding:0; background-image:url(main%20bg.jpg) } ul { padding:0; margin:0; } /* end of elements */ /* id's */ #container { margin-left:auto; margin-right:auto; width:1000px; } #body { border:5px solid #cf0; width:1000px; height:1000px; background-image:url(middle%20bg.png); } #navbar { position:relative; top:12px; text-align:center } /* end of is's */ /* classes */ .navbar { list-style:none; } ul.navbar li { display:inline; margin:0; padding:0px; text-align:center; } ul.navbar { background-color:#00ccff; padding:10px; margin:0px; text-decoration:none; color:#cf0; border-radius:100px; border:2px solid white; } ul.navbar a:hover { ...

.net - Bug.Field method not available in C sharp. But available in VB.net for OTA Client -

i trying connect hpqc , list of defects , fields using otaclient.dll but when use c # code this bug thenewbug ; console.writeln( thenewbug.field("sdf")); it not compile but dim thenewbug bug dim abc abc = thenewbug.field("sdf") compiles properly. i using same dll both i want know how use field property of bug in c # i suspect field collection. in c#, use square brackets parameter indexer, in same way use square brackets arrays. so try console.writeln(thenewbug.field["sdf"]);

c++ - Convert OpenGL output to H264 with x264 -

i want convert output of opengl program h264 , stream output. got collected of code somewhere , output file have no idea it, or if valid. output saved in file.h264. edit: "global" variables x264_param_t param; x264_t* encoder; x264_picture_t pic_in; x264_picture_t pic_out; x264_nal_t *headers; int i_nal; file* pfile; my init function: initx264() { pfile = fopen("file.h264", "wb"); x264_param_t param; x264_param_default_preset(&param, "veryfast", "zerolatency"); param.i_threads = 1; param.i_width = 1024; param.i_height = 768; param.i_fps_num = 30; param.i_fps_den = 1; param.i_keyint_max = 30; param.b_intra_refresh = 1; param.rc.i_rc_method = x264_rc_crf; param.rc.f_rf_constant = 25; param.rc.f_rf_constant_max = 35; param.b_annexb = 0; param.b_repeat_headers = 0; param.i_log_level = x264_log_debug; x264_param_apply_profil...

android - How to force my GridView adapter to reload? -

i'm android beginner starting fragments. problem following. has fragment used show custom listview (it extended sherlocklistfragment). populated listview data server. action of retrieveing data of server executed in thread , had handler manage responses. in handler (inside fragment) recovered data adapter , reloaded adapter ((myadapter) fragment.getlistadapter()).datachange(); . well, wanted convert list in custom grid cause think it's better app. so, fragment doesn't extends sherlocklistfragment, basefragment. don't have listview anymore, can't not use "getlistadapter.datachange()". know correct way this? in advance. make adapter gridview extends baseadapter, or use adapter extends baseadapter. then call notifydatasetchanged on adapter when contents of collection has changed. small example of adapter , grid

arrays - Looping Issues in Java -

Image
i'm making simple currency converter gui (nothing fancy) going try , incorporate live exchange rate updates each time user opens application. when creating layout, have decided simple convert 3 currencies (gbp, usd , eur). have respective flags in 2 columns, each column has 1 of 3 flags. 1 column user select initial currency , other desired currency exchange to; seen below i have created string array contains words "pounds", "dollars" , "euros" , wanting put these labels left of flags (for clarity of application user not every user may know currency belongs country. i created loop create label , assign left of flags, supposed make "pound" label, "dollar" "euro" each time traversing y axis south aligns flags , reset array count go correct string, move along x-axis , repeat again. not doing @ all, result text "pounds " left of first united kingdom flag; seen below: below code if can see why happening. ...

How to get the status of spawn process in twisted python? -

i want trigger many long running processes continiously. and, based on status returned of each process executed, need perform other tasks. in below example, i'm able spawn processes, i'm not able capture/get details of spawn processes execution status returned mail loop(i.e in cmdprotocol class). i'm new twisted python concepts - can me here? import sys twisted.internet.protocol import serverfactory, processprotocol twisted.protocols.basic import linereceiver twisted.internet import reactor twisted.internet import protocol import os import signal class mypp(protocol.processprotocol): def __init__(self): self.parent_id = os.getpid() def connectionmade(self): print "connectionmade!" print "parent id = %s" % self.parent_id print "child process id = %s" % self.transport.pid def outreceived(self, data): print "out", data def errreceived(self, data): print "er...

How find first checked item index in a c# checkedlistbox with lambda -

i need set selectedindex of mycheckedlistbox first checked item index of list , highlight it. how write lambda expression select min index of mycheckedlistbox.checkeditems alternate using loop. you don't need lambda or loop. selectedindex property that. from msdn: listcontrol.selectedindex property gets or sets lowest ordinal index of selected items in list.

c++ - C++11 code/library in non C++11 program -

assume compile code in c++11 (i'll use lambdas) ".o" or library ".a". , have program, include previous library , header file, can't compile c++11, old 1 ( c++98 ). compile , work fine? probably not. reason name mangling (why abi changes) in c++ exists because incompatibility differences between c++ versions can make code unstable if work @ all. if have code doesn't compile against c++11, you'll have refactor 1 of programs compile against other compiler. (most old code compile new compiler) if isn't option, can try , make c++11 lib dll c interface or com object interface, exceptions stop @ boundary, , if go dll route, more want write wrapper class access c++11 object, acts object on pre c++11 side of boundary.

function - Why PHP include is not working? -

i'm trying make page view counter. i'm newbie php. here problem: i'm using code in "index.php": <?php include "visitcounter.php"; ?> and using following code in "visitcounter.php": <?php session_start(); if(isset($_session['visitcount']) { $_session['visitcount'] = $_session['visitcount']+1; } else { $_session['visitcount'] = 1; } echo "total page views = ".$_session['visitcount']; ?> the problem page index.php showing server error. if change code following code in index.php: <?php include "/visitcounter.php"; ?> then page not show error message display nothing. please me figure out wrong i'm doing. first of all, point mentioned of silvio silva problem. change from: session_start() to: session_start(); to avoid such problems in future, add file: ini_set("display_errors","on"); error_reporti...

php - RegEx - If Our Site URL Contains This, Then -

need regex regex newb. if our url contains searchbox. (searchbox dot on end) or searchbox-empty then, need something. example matching urls be: http://www.thesite.com/searchbox.html or http://www.thesite.com/searchbox-empty.html and non-matching url be: http://www.thesite.com/searchbox-function.html so, want matched when there not function being called. here have far: if((preg_match("@searchbox\.@",$_server['request_uri']) || preg_match("@searchbox\-empty@",$_server['request_uri'])) && !empty($_request['id']) && is_numeric($_request['id'])) { thanks help! if recall correctly, need escape backslashes: "/searchbox(?:\\.|-empty)/"

javascript - Dropdown menu, anchor doesn't work -

i have made dropdown menu , works fine, except anchor ( a href="#" ) not work. i think script has wrong, can't figure out. can can me please? <ul class="menu"> <li class="listmenu on"> <a class="depth1" href="#">aaa</a> <div class="depth2wrap"> <ul class="depth2"> <li><a href="b.html">bbb</a></li> <li><a href="c.html">ccc</a></li> </ul> </div> </li> <li class="listmenu"><a class="depth1" href="d.html">ddd</a></li> </ul> $(function($) { var li = $('.menu>.listmenu'); li.addclass('off'); $('.menu .on').find('.depth2wrap').show(); $('.menu>.listmenu>a').click(fun...

ios - Can I code in Xcode 5 and then comment out the iOS7 specific code before I submit with Xcode 4? -

there few layout issues need resolve new ios version , there new method, let’s call newmethodthatisnotinios6 can use code fix them: if ([self respondstoselector:@selector(newmethodthatisnotinios6)]) { self.newmethodthatisnotinios6 = parameter; } this code works fine in xcode 5 won’t compile in xcode 4 because method not defined. right now, comment out code when working on new apps ios6, there way compile in xcode 4? alternatively, can safely code in xcode 5 , strip out ios7 specific code before submit xcode 4? you can exclude code precompile macro's like: #ifdef __iphone_6_0 if ([self respondstoselector:@selector(newmethodthatisnotinios5)]) { self.newmethodthatisnotinios5 = parameter; } #endif this include method compiling ios 6+ sdk , not used if compiling ios 5 sdk.

casting - PHP cast to integer returns wrong value -

have @ friend , tell me i'm not crazy... echo (int) (9.45 * 100); // gives 944 echo (int) 945; // gives 945 i don't understand why first instruction return 944!???? known php issue? appreciated always! according php documentation ( http://php.net/manual/en/language.types.integer.php ) when converting float integer, number rounded towards zero. that's why getting 944.

java - Converting an ANSI file with German characters to UTF8 -

i have downloaded plain text files german website not sure encoding is. there no byte markers in file. using parser assumes files encoded in utf8, not handling accented characters (those fall in byte range > 127) i convert utf8 not sure if need know encoding this. the way others have been handling these files manually open in windows notepad , re-saving in utf8. process preserves accented characters, automate conversion if possible without resorting windows notepad. how windows notepad know how convert utf8 properly? how should convert file utf8 (in java 6)? in java 7 text "windows-1252" windows latin-1. path oldpath = paths.get("c:/temp/old.txt"); path newpath = paths.get("c:/temp/new.txt"); byte[] bytes = files.readallbytes(oldpath); string content = "\ufeff" + new string(bytes, "windows-1252"); bytes = content.getbytes("utf-8"); files.write(newpath, bytes, standardoption.write); this takes bytes, ...

maven - Getting "Skipping JaCoCo execution due to missing execution data file" upon executing JaCoCo? -

i'm using maven 3.0.3, junit 4.8.1, , jacoco 0.6.3.201306030806, , trying create test coverage reports. i have project unit tests can't reports run, repeatedly getting error skipping jacoco execution due missing execution data file when run: mvn clean install -p test-coverage here how pom configured: <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.14.1</version> <configuration> <reuseforks>true</reuseforks> <argline>-xmx2048m</argline> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-failsafe-plugin</artifactid> <version>2.14.1</version> <configuration> <reuseforks>true</reuseforks> <argline>-xmx4096m -xx:maxpermsize=512m ${itcoverageagent}</argline> </configurati...

jquery - interaction Django and Ajax -

i'm trying send data server , use ajax function stats(e){ jquery.ajax({ type: "post", url:"stats", data:{'csrfmiddlewaretoken': document.getelementsbyname('csrfmiddlewaretoken')[0].value, 'test':{}}, success: function(data) {alert("congratulations!"+data);}, error: function(data) { alert("please report error: "+data.responsetext);} }); } function in views.py: def stats(request): if request.is_ajax(): if request.user.is_authenticated(): if request.post: return httpresponse(request.post['test']) else: return httpresponse("post_no_exists") else: return httpresponse("no authenticate") else: raise http404 django raise multivaluedictkeyerror 'key "test" not found in querydict'. when change "test":{} -> "test":1 succeds. whats err...

osx - Preferring one function when a keybinding in two emacs packages overlap -

on os x, .emacs containing lines: (require 'dired) (add-hook 'dired-load-hook (function (lambda () (load "dired-x")))) dired-omit-mode in dired-x , ns-open-file-using-panel in ns-win fight on keybinding m-o. i understand .emacs above specifying dired-x should loaded after dired—and hence binding of m-o in dired-x should take on when emacs starts. not case. reason binding in ns-win wins. how can force dired-x keybinding @ startup? edit (following phils' suggestion) if .emacs loads 2 other packages define m-o (require 'ns-win) (require 'facemenu) (require 'dired) (add-hook 'dired-load-hook (function (lambda () (load "dired-x")))) even though dired loaded last, binding in facemenu still takes over. first, load ns-win , sets binding. this: (add-hook 'dired-mode-hook (lambda() (require 'dired-x) (define-key dired-mode-map (kbd "m-o") 'di...

css - How to center a list of icons on en amil (email html) -

i'd put in email series of 4 social icons centered (horizontally) keep being put gmail , yahoo on left side! <body bgcolor="#ffffff" style="margin: 0;padding: 0;-webkit-font-smoothing: antialiased;-webkit-text-size-adjust: none;height: 100%;width: 100%;"> <table style="margin: 0;padding: 0;width: 100%;border-collapse: collapse; background-color: #f2f2f2;"> <tr> <td style="margin: 0 auto; padding: 0;display: block;max-width: 600px;clear: both; align: center; valign: top; background-color:#ffffff ;"> <table width="100%" style="padding:0px 5px 0px 5px;" cellspacing="0" border="0" bgcolor="#ffffff" align="center"> <tbody> <tr> <td style="float:left;margin-left:6px;margin-right:6px;margin-top:10px; margin-bottom: 30px;"> ...

c++ - Opengl Texture Mapping of GL_QUADS, got strange result -

i got strange result texture mapping. i used 128*128 rgba bmp image texture mapping of gl_quads , got following strange result, test other images ok, image, got strange result. here want map leaf image gl_quads . the following code: void init (void) { glclearcolor(0.6, 0.6, 0.6, 0.0); glcleardepth(1.0); glshademodel(gl_smooth); gltexparameteri(gl_texture_2d,gl_texture_mag_filter,gl_linear); gltexparameteri(gl_texture_2d,gl_texture_min_filter,gl_linear); gltexparameteri(gl_texture_2d, gl_texture_wrap_s, gl_repeat); gltexparameteri(gl_texture_2d, gl_texture_wrap_t, gl_repeat); glenable(gl_texture_2d); glutsetcursor(glut_cursor_crosshair); } void display(){ glclear(gl_color_buffer_bit | gl_depth_buffer_bit); glloadidentity (); glulookat(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0); gluint texture[2]; unsigned int outwidth; unsigned int outheight; unsigned int outdepth; glgentextures(1, &texture[0]); glbindtexture(gl_texture_2d, texture[0]); unsigned char * data=...

php - Prevent users from accessing member pages by entering cached url -

i have website members have login noticed after logging out can enter page url in browser , go in without using login form, how prevent this. what mean believe there way me check if session valid on pages. non users can put url in browsers , enter without logging in. use session variable in php. session_start(); $_session['login'] = true; this creates session variable called 'login' can used verify whether user logged in. now, have check variable : if($_session['login'] == true){ /*goto user page*/ }else{ /*redirect somewhere else */ } to create logout button, ensure users can't copy-paste url again , enter, session_destroy(); will work fine.

ruby on rails - Debugging Rufus scheduler -

i doing in rails console: job = scheduler.at 1.minute.from_now service.log.debug 'scheduler works' end job.schedule_info => wed, 07 aug 2013 16:14:46 utc 00:00 scheduler defined in other file: require 'rubygems' require 'rufus/scheduler' def scheduler @scheduler ||= rufus::scheduler.start_new end and when run in console: service.log.debug 'scheduler works' service log file written. problem scheduler.at 1.minute.from_now service.log.debug 'scheduler works' end does not write in log after minute. missing? how debug this? actual problem i have server in ec2 seems shutdown , scheduled tasks not run. thing in development environment test task running in 1 minute , works. in server not in console. in console, mentioned failing. dev environment ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin12.0.0] thin 1.5.0 remote environment ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-linux] apache2 2.2....

css3 - pseudo elements IE10 button -

i put button using :before , :after elements , ie10/9 ignoring them completely, far can tell should working in @ least 2 versions. .buttonsml { background-position:-35px -432px; background-color: transparent; border: none; text-transform: uppercase; font-size: 2.9rem; font-weight: @font-bold; height: 55px; padding: 0 5px; position: relative; .text-shadow(0,0,4px); cursor: pointer; } .buttonsml:before, .buttonsml:after { content: " "; position: absolute; top: 0; height: 55px; width: 20px; display: inline-block; visibility: visible } .buttonsml:before { background-image: url('../images/sprite.png'); background-position: 0px -432px; background-repeat: no-repeat; background-color: transparent; left: -20px; } .buttonsml:after { background: url('../images/sprite.png'); background-position: -394px -432px; background-repeat: no-repeat; background-color:...

automation - Android uiautomator Maintainability/Stability Across Manufacturers -

i have configured , installed sl4a . going automate android using scripting platform base. many pieces of functionality seek automate may exposed through reflection. may manipulated using ui automation. have considered use of uiautomator , java reflection methods. aware reflected methods tend undocumented, uncertain , unstable across versions. however, allow degree of command line interfacing. most important endeavor code maintainability. after reading uiautomator tool documentation , exploring methods, convinced implement it, api looks clean , effective. my questions these: issues, if any, exist maintaining uiautomator tool new versions of android come online? tool api relatively stable across manufacturers, general rule, or can "finicky" behavior anticipated?

PHP TIME converting? -

i have in database shows time when users signed on recorded .. when person makes user saves script (time ();) in database under variable name "regtim". if use echo print out, example:      1375202508 how can make date if possible? or example mentioned below. for example: 08/06/2013 2:11 you can use date() function timestamp mention in second argument, date ( string $format [, int $timestamp = time() ] ) or in case: date('m/d/y h:m', 1375202508); you can read more on http://php.net/manual/en/function.date.php

Variable From PHP to Javascript -

i have code in html: <a id="<?echo $result[id]?>" onclick="displayresult()"></a> and want id number link without refresh page function: <script> function displayresult() { <? connection = mysql_connect('localhost', 'root', '...'); $db = mysql_select_db('webfaturas', $connection); $sql = mysql_query("select * `artigos` id = $id"); $resultado = mysql_fetch_array($sql); ?> </script> so can sql query id = id cames without refresh page. what you'll want grab id of link via javascript, , post php script using ajax. jquery makes easier using straight javascript - suggest reading documentation. http://api.jquery.com/jquery.post/

filesystems - What is lazy space allocation in Google File system -

i going through google file system (gfs) paper, mentions gfs uses lazy space allocation reduce internal fragmentation. can explain, how lazy space reduces internal fragmetation? source: http://research.google.com/archive/gfs-sosp2003.pdf with lazy space allocation, physical allocation of space delayed long possible, until data @ size of chunk size (in gfs's case, 64 mb according 2003 paper) accumulated. in other words, decision process precedes allocation of new chunk on disk, heavily influenced size of data written. preference of waiting instead of allocating more chunks based on other characteristic, minimizes chance of internal fragmentation (i.e. unused portions of 64 mb chunk). in google paper, says: "most chunks full because files contain many chunks, last of may partially filled." so, same approach applied file creation. it analogous this: http://duartes.org/gustavo/blog/post/how-the-kernel-manages-your-memory

java - Using media player and camera to realize live video chat in android,based sockets -

yes,i have requirement list follows(maybe can called simple ideas) 1.using camera , mediarecoder recording video (now can record , save file) refer: http://developer.android.com/guide/topics/media/camera.html 2.when recording video,i need send server transit (i plan use socket[tcp] realize) 3.server receive socket data , transit client(android/pc) 4.at same time,server send video streaming android client socket (i try using parcelfiledescriptor.fromsocket(client) ,but catch ioexception:setdatasourcefd failed.: status=0x80000000) refer: stream live video phone phone using socket fd 5.android client receive server's data , play using mediaplay , surfaceview 6.in addition,i want server can switch video streaming socket data or local file,when server transit data this idea,but don't know if feasible , don't know how achieve it wonder if can give me references or examples, thanks btw, first time ask question in stackoverflow,before view question...

Auto-close Bootstrap accordion panel when switch to mobile screen size -

using bootstrap 2.3.2 have accordion single panel open when page loaded. <div class="accordion" id="refine"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#refine" href="#refine-search"> title </a> </div> <div id="refine-search" class="accordion-body collapse in"> <div class="accordion-inner"> test text.... </div> </div> </div> the site responsive. when switching mobile screen size [ @media (max-width: 979px) ] want accordion panel close automatically, i.e. want div refine-search line change "collapse out". when in mobile mode, accordion must still work, e.g. user can...

Laravel, how to use form helper outside blade? -

for reason have write html::macro() return html tags. html::macro('mymycro', function() { $result = '<form id="xxx">...'; return = $result; } then can use html::mymacro() inside blade. {{ html::mymacro() }} is possible use form helper form::open(), form::input() generate html tags inside macro don't have manually write tags??? if so, please suggest me how because of poor background in php , laravel, tried ... $result = form::open('some_parameters'); ... but didn't work, don't know can use form helper outside blade or not, please advise me. thanks. i dont see reason why not. works charm form::macro('myform', function() { $output = form::open(['url/to/post']); $output .= form::text('firstname'); $output .= form::close(); return $output; }); // use in in regular php view... echo form::myform(); // ... or blade view {{ form::myform() }}

html - Using CSS Selectors Incorrectly -

i have code looks below. using css try , assign span tag id="tl_quantity$0" padding-right of 20px . i'm using css selectors incorrectly. know how change end of css assign span tag padding not directly calling id? here html: <td id="tdtl_payable_time$0#2" class="pslevel1gridoddrow" width="127" align="left" style=""> <td id="tdtl_payable_time$0#3" class="pslevel1gridoddrow" width="152" align="left" style=""> <td id="tdtl_payable_time$0#5" class="pslevel1gridoddrow" width="105" align="left" style=""> <td id="tdtl_payable_time$0#6" class="pslevel1gridoddrow" align="right" style=""> <div id="win10divtl_quantity$0" style="width:78px;"> <span id="tl_quantity$0" class="pseditbox_disponly"...

c# - Does Sql Server Compact Edition 3.5 query timeout? -

i realized sqlceconnection , sqlcecommand objects timeout properties readonly default value set 0. mean queries sqlce database never timeout? no timeout , can define timeout in connection string this sqlceconnection conn = new sqlceconnection(); conn.connectionstring = "persist security info=false; data source = northwind.sdf;" + "password = <password>; server=mysqlserver;connect timeout=30"; this whay msdn has say. connectiontimeout property time (in seconds) wait connection open. value 0 in sql server compact readonly.

javascript - If variable equals the number 1 -

i'm trying write simple if statement in jquery. if variable equals number 1 this, if equals number 2 this. wrote doesn't seem work , can't figure out why: $("#next-btn").click(function() { if (current_slide = 1) { first_screen(); }, else if (current_slide = 2) { second_screen(); } }); probably simple, appreciate help. you need use comparison operator == in if statement condition instead of assignment operator = remove comma after first closing curly bracket of then (true) block of if statement. can test on here . if (current_slide == 1) { first_screen(); } else if (current_slide == 2) { second_screen(); } i assume current_slide has number compare, read below how comparison operator == performs comparison. comparion equal operator if 2 operands not of same type, javascript converts operands applies strict comparison. if either operand number or boolean, operands converted numbers if ...