Posts

Showing posts from July, 2014

php - Apache configuring ssl -

i have following namevirtualhost *:443 <virtualhost 55.55.55.55:443> #<virtualhost *:443> sslengine on sslcertificatefile /path/to/cert/mycert.crt sslcertificatekeyfile /path/to/key/mykey.key sslcacertificatefile /path/to/bundle/bundle.crt serveradmin info@mydomain.com servername www.mydomain.com documentroot /var/www/html/ </virtualhost> i have java program accesses above url using https. when comment out virtualhost line ip address , uncomment wildcard line, java program gives me "peer not authenticated" exception. when leave is, java program works expected. main reason want way have other subdomains define other sections. what issue using wildcard virtualhost line? the issue defining ip address directive being used. however, when used *:443 directive have servername www.mydomain.com , not accessing www when try access page virtualhost block not being used. rather there _default:443 directive in different c

encoding - What's the best way to url encode only query keys and params in Java? -

i encode query keys , parameters of url (don't want encode /, ? or &). what's best way in java? for example, want convert http://www.hello.com/bar/foo?a=,b &c =d to http://www.hello.com/bar/foo?a=%2cb%20&c%20=d build url this: string url = "http://www.hello.com/bar/foo?"; url += "a=" + urlencoder.encode(value_of_a); url += "&c=" + urlencoder.encode(value_of_c);

c# - Castle interface proxy with a dynamic target -

i trying use castle dynamicproxy implement typesafe version of signalr hub. goal being when use clients.all rather getting dynamic object have interface use. the code rather hacky @ moment wanted prove work before go through trouble of making nice: public interface ichatclient { void broadcastmessage(string name, string message); } public class chathub : typesafehub<ichatclient> { public void send(string name, string message) { clients.all.broadcastmessage(name, message); } } public abstract class typesafehub<tinterface> : hub tinterface:class { public new typesafehubcallerconnectioncontext<tinterface> clients { { return new typesafehubcallerconnectioncontext<tinterface>(base.clients); } } } public class typesafehubcallerconnectioncontext<t> t:class { private ihubcallerconnectioncontext context; private proxygenerator proxygen; public typesafehubcallerconnection

java - How to use GWT $entry Function in JSNI? -

the $entry function in gwt used uncaught exceptions reported javascript gwt. what difference between following $entry calls , 1 correct one? the following versions call instance java functions. version 1: public final native string test(double arg) /*-{ var instance = this; var callexternal = $entry(function(arg) { return instance.@com.example.myclass::javafunction(d)(arg); }); var x = callexternal(arg); }-*/; version 2: public final native string test(double arg) /*-{ var x = $entry(instance.@com.example.myclass::javafunction(d)(arg)); }-*/; is there different use whether use static or non static java functions? update: the following versions call static java functions. version 1: public final native string test(double arg) /*-{ var callexternal = $entry(function(arg) { return@com.example.myclass::javafunction(d)(arg); }); var x = callexternal(arg); }-*/; version 2: public final native string test(double

PHP If statement not working as I thought it should -

i'm trying set error checking on form, have following far: if (empty($fname)) { $error = true; $error_fname = "please fill in first name"; }else if (empty($lname)) { $error = true; $error_lname = "please fill in first name"; } and although in first if statement assigns string variable $error_fname is, second else if statement nothing, doesn't assign error variable. any this? if meet first condtion never throw second, don't use if else 2 if , put error in array otherwise might overwrite if both condition met $error_lname = array(); if (empty($fname)) { $error = true; $error_lname[] = "please fill in first name"; } if (empty($lname)) { $error = true; $error_lname[] = "please fill in last name"; } if need 2 separate errors might use different variables if (empty($fname)) { $error = true; $error_fname = "please fill in first name"; } if (

"Launch failed. Binary not found" error for C in Eclipse 4.3.0 on OS X 10.9.2 -

since today have not been able compile c programs in eclipse not create necessary binaries when build project, in fact won't create binaries folder @ all. have tried i've seen on here try fix it, , it's gotten worse. here's i've tried far , results: from "launch failed. binary not found." snow leopard , eclipse c/c++ ide issue , in terminal: cd /usr/bin sudo rm cc gcc c++ g++ sudo ln -s gcc-4.0 cc sudo ln -s gcc-4.0 gcc sudo ln -s c++-4.0 c++ sudo ln -s g++-4.0 g++ this supposed change path 32-bit gcc 4.0 64-bit 4.2. after doing however, had major problem: no longer had type of gcc evidenced fact when called gcc -v in terminal, returned: -bash: gcc: command not found in attempt make things right, re-downloaded command line tools xcode , reinstalled them, , xcode acknowledges indeed installed. despite this, calling gcc -v still returned -bash: gcc: command not found. after repeating process, got same result, makes seem if cannot install/fi

php - Values Cannot be read by MySQL? -

i have query in mysql, have values in database there comma example (monday, tuesday). reads data if there 1 inside (monday) or (tuesday) when data more 1 , comma mysql doesn't read it. i've tried charindex didn't work or maybe used wrong syntax. help. here's snippet want read data if (date_format(ts.`date`, '%w') <> r.`number`, 0, 1) 'restday' i tried if (charindex(date_format(ts.`date`, '%w') <> r.`number`, 0, 1)) 'restday' but sends error message

javascript - CamanJS revert and rotate fix -

if use rotation plugin in camanjs there issue when trying revert changes. caman implemented in way working when crop or resize image, not when rotate it. when revert , image rotated image reloads distorted, because doesn't take under consideration canvas has rotated , changed size. imagedata.data of canvas different now. think fixxed looking how implemented resize. basicaly did (and too) is: create canvas in initial state update pixeldata initialstate create new canvas rotate him initial image get imagedata , rerender them so added. needed know how many angles image rotated can correct imagedata when rotate new canvas (step 4). this.angle=0; //added in constructor i added new boolean in constructor tell me if canvas rotated this.rotated = false; in rotated plugin: caman.plugin.register("rotate", function(degrees) { //.... //.... //.... this.angle += degrees; this.rotated = true; return this.replacecanvas(canvas); } and on

c# - ListPicker FullModeItemTemplate Issue -

my list picker contains lot of items.so used fullmodeitemtemplate: <toolkit:listpicker.fullmodeitemtemplate> <datatemplate> <textblock margin="10,0,0,14" fontsize="30" foreground="white" text="{binding localizefamilylabel}" /> </datatemplate> </toolkit:listpicker.fullmodeitemtemplate> the problem when navigating , again. can open it, navigate view.when navigate back, corrupted, items rearranged contains spaces. what must find arranged when navigating again list? regards, did put set items source code in onnavigatedto event? protected override void onnavigatedto(navigationeventargs e) { listpicker.itemssource = // source } if this, page reset listpicker items, items rearranged. wish can you.

javascript - How to remove style of all Divs matching particular criteria? -

i having following html structure=> <span style="font-size:13px;"> <div style="margin-top:14pt;margin-bottom:1em;"><br> <font size="1"><span style="font-size:12px;"><b>name:</b></span></font><font size="1"><span style="font-size:12px;"> pratikjj jj</span></font></div> <div style="margin-top:14pt;margin-bottom:1em;"><font size="1"><span style="font-size:12px;"><b>email:</b> <a target="_blank" href="redir.aspx?c=aqq9qrs3s0ccur8wyx3quu0hmt-cf9ei3kjbziy3j26howkecgal2vvhktrt0q8mek1s8kdowtw.&amp;url=mailto%3apratik.joshi%40aressindia.net">pratik.joshi@aressindia.net</a></span></font></div> <div style="margin-top:14pt;margin-bottom:1em;"><font size="1"><span style="font-size:12px;">

Uploadify upload folder renaming -

i using latest flash version of uploadify (v3.2.1 think). if set upload folder name ' tempupload ' doesn't upload (although move_uploaded_file returns true ), eg this not work $targetfolder = '/path/tempupload'; this work $targetfolder = '/path/dave'; any suggestions ?

jquery - Ring-shaped process spinner with fading gradient effect around the ring -

Image
i want create ring-shaped process spinner css3 or javascript, similar loading progress spinner in android. the spinner should rotate continuously , filled solid colour fades out along rim (i.e. conical gradient) in picture: how can achieve this? this trivially easy if css or svg had conical gradients! until conic-gradient() notation matures , gains support, can approximate effect slicing gradient , covering seams somehow. below find 2 solutions. first solution uses embedded svg image; second uses multiple css gradients , pseudo-elements. both start single div keyframe animation applied make rotate: html: <div class="spinner"></div> css: @keyframes rotate { { transform: rotate(0deg); } { transform: rotate(360deg); } } .spinner { animation: rotate 1s linear infinite; height: 200px; width: 200px; } you can use progress element if prefer, find pain style. note unless you're using prefixfree.js , you

transition - TransitionManager scene animation behavior with root layout -

i'm testing out android kit kat transition feature. when transition happens, margins of root layout getting padded. find behavior strange. the source public class mainactivity extends actionbaractivity { button btn; textview txt; @targetapi(build.version_codes.kitkat) @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); txt = (textview)findviewbyid(r.id.text); btn = (button)findviewbyid(r.id.btn); btn.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { viewgroup root = (viewgroup)findviewbyid(r.id.root); scene scene = scene.getsceneforlayout(root, r.layout.activity_main2, mainactivity.this); transitionmanager.go(scene); } }); } ... } activity_main.xml <relativelayout xmlns:android="

Get mysql rows where date timestamp is 30 days or newer -

i trying bunch of mysql rows last 30 days using sql: select * `articles` date >= date(now() - interval 30 day) order `views` desc i doing wrong returns rows last year. my date field in gmt timestamp. if date field not datetime , timestamp , or date field type (as think you're indicating "in gmt timestamp" - suspect you're storing integer itself), you're not going able comparison that. you'd need convert 30 days ago date timestamp too. where date >= unix_timestamp(date(now() - interval 30 day))

iphone - iOS Static Library + CocoaPods and the duplicate symbols error -

i'm developing static library / ios framework (jeff verkoeyen way) , i've added cocoapods manage dependencies (this big difference other questions duplicate symbols). i've been struggling "duplicate symbols" problem when client use cocoapods use static library / framework , 3rd party library i'm using too. i've been reading answers talking not including 3rd party libraries custom static library want way, not option. i've found this article (thank ryan arana) talks problem , "the best" solution , i've had adapt cocoapods driven static library: 1. create empty namespaceddependencies.h in root of workspace , add main project. 2. add prefix header of main project (before include of pods): #import "namespaceddependencies.h" 3. add hook podfile: post_install | installer | environment_header = installer.config.project_pods_root + 'pods-environment.h' text = "#import \"name

Python: solving unicode hell with unidecode -

i have been working on ways flatten text ascii. ā -> a , ñ -> n , etc. unidecode has been fantastic this. # -*- coding: utf-8 -*- unidecode import unidecode print(unidecode(u"ā, ī, ū, ś, ñ")) print(unidecode(u"estado de são paulo")) produces: a, i, u, s, n estado de sao paulo however, can't duplicate result data input file. content of test.txt file: ā, ī, ū, ś, ñ estado de são paulo # -*- coding: utf-8 -*- unidecode import unidecode open("test.txt", 'r') inf: line in inf: print unidecode(line.strip()) produces: a, a<<, a<<, a, a+- estado de sapso paulo and: runtimewarning: argument not unicode object. passing encoded string have unexpected results. question : how can read these lines in unicode can pass them unidecode ? use codecs.open with codecs.open("test.txt", 'r', 'utf-8') inf:

Java String.split() regex for handling escaped delimeter and escaped escape characters -

string teststring = "a\\,b\\\\,c,d\\\\\\,e,f\\\\g"; string[] splitedstring = test.split(pattern_string); (string string : splitedstring) { system.out.println(string); } here have string encodes list of string string escape character \ , delimiter , note:(back slashes in example doubled because of java code) backslash , comma escaped in original strings , result strings merged comma. need regex split string original list of strings. example of string "a\,b\\,c,d\\\,e,f\\g" need such strings: "a\,b\\" "c" "d\\\,e" "f\\g" so logic of split simple: split delimiter comma if number of backslashes directly before even: 0,2,4... in case comma delimiter. if number of backslashes before comma odd escaped comma , no split should occur. can me appropriate regex case? edit know regex: (?<!\\\\), split string commas not have backslashes before it. in case need split in case number of slashes before comma even. a

Why is Data.Word in Haskell called that? -

why unsigned integral type in haskell called "word"? "ord" stand "ordinal"? here documentation on data.word: http://hackage.haskell.org/package/base-4.6.0.1/docs/data-word.html#t:word this hard question google! from wikipedia : the term 'word' used small group of bits handled simultaneously processors of particular architecture. size of word cpu-specific. many different word sizes have been used, including 6-, 8-, 12-, 16-, 18-, 24-, 32-, 36-, 39-, 48-, 60-, , 64-bit. since architectural, size of word set first cpu in family, rather characteristics of later compatible cpu. meanings of terms derived word, such longword, doubleword, quadword, , halfword, vary cpu , os. in short, word fixed-length group of bits cpu can process. work words powers of two, since modern cpus handle well. word in particular not number, although treat such purposes. instead, think of fixed number of bits in ram can manipulate. common use word8

Sencha touch 2 setActiveItem main view error -

i implementing sliding navigation. when 1 of list items in slide navigation clicked, i'm using following controller code load relevant view: switch(index){ case 0: this.getmain().setactiveitem({xtype:'main'}); break; case 1: this.getmain().setactiveitem({xtype:'messagesview'}); break; case 2: this.getmain().setactiveitem({xtype:'articleslistview'}); break; case 3: this.getmain().setactiveitem({xtype:'categoriesview'}); break; default: break; } every 1 of setactiveitem function calls work except first on. when try set main view active view, following error: uncaught error: [error][ext.container#doadd] adding card tab container without specifying tab configuration can me resolve problem? this.getmain().setactiveitem(0); the code above solved problem

.net - How to detect a double-click outside of vb.net form -

Image
setup environment: i'm using visual studio 2010 , writing code in vb.net (with .net framework 4). my goal: use shell("c:\myprogram.exe", appwinstyle.normalfocus) open new application with new application open active window, recognize when user double clicks if active window vb.net form, it's simple recognize double click event so: private sub button2_doubleclick(......) handles button2.doubleclick end sub this code works recognize single left click: this form1.vb public class form1 private withevents mousedetector mousedetector private sub form1_load(byval sender object, byval e system.eventargs) handles me.load mousedetector = new mousedetector end sub private sub mousedetector_mouseleftbuttonclick(byval sender object, byval e system.windows.forms.mouseeventargs) handles mousedetector.mouseleftbuttonclick 'left click occurred msgbox("left click") end sub end class

C Programming Increment and Decement Operaotr Proble -

this question has answer here: why these constructs (using ++) undefined behavior? 12 answers undefined behavior , sequence points 4 answers $void main() { int a=10,c; c= ++a + ++a; printf("%d",c); } this program actuly print valu of c=24 calculation can should c=23 ,how possible your program has bug -- modify same variable twice without intervening sequence point. fix bug , mystery go away. a deep understanding of not how language works how compilers work required understand why buggy code happens happens do. suggest not writing buggy code and, when find bug, fix instead of trying understand precisely why , how broke. my advice stop. learned right lesson -- code triggers undefined behavior unpredictable , doesn't might expect do. that's need

Remove facebook HipHop (hhvm) Ubuntu and debug it -

i have installed hhvm using building , installing hhvm in ubuntu 13.10 github , want uninstall system completely. not getting documentation regarding this. i uninstalling because not able make server using: hhvm -m server -p 8080` nor ` hhvm -m server -vserver.type=fastcgi -vserver.port=8080 it giving error like warning: logging before initgooglelogging() written stderr e0321 17:09:56.491703 13532 fastcgi-session.cpp:562] fastcgi protocol: received invalid record run sudo /usr/share/hhvm/uninstall_fastcgi.sh the run sudo apt-get remove hhvm then restart server(nginx/apache)

c# - if increasing/decreasing, do something -

i check whether integer increasing or decreasing , something. int x = 0; int y = 0; if x increasing in value, y --; thanks! //loop starts //x gets modified if(x>tempx) { //x increments } else if (x<tempx) { //x decrements } else //x remains same int tempx=x; //loop ends

c# - Having Issues with using VISIBLE. My Javascript doesnt seem to be handling the event when the check box is clicked -

all of hidden fields have id's. , in javascript in trying set visible false true on payment selection. cash payment should display address sent to. credit card payment comes text boxes , labels in order process payment online. when run script wont appear checkbox selection. assigned onclick event , still doesnt work. suggestions? <%@ page title="" language="c#" masterpagefile="~/site.master" autoeventwireup="true" codefile="shoppingcart.aspx.cs" inherits="shoppingcart" %> <asp:content id="content1" contentplaceholderid="headcontent" runat="server"> <head> <script type="text/javascript"> function paymentfunction() { if (document.getelementbyid("rbcash").checked) { document.getelementbyid("lbcash").visible = true; document.getelementbyid("lbcash2").visible = true;

javascript - How to create ad-hoc tweens sequence without recursion in KineticJS? -

is possible create tweens sequence in kineticjs according data saved in array without recursion? this current solution including recursion: function tweenfunc( image ) { setglobalcoordinates(); tween = new kinetic.tween({ node: image, duration: 1, x: x, y: y, rotation: rot, onfinish: function(){ if ( counter++ < arr.length ) { tweenfunc( image ); } } }); tween.play(); } i have solution creates tweens before first animation , following tweens start final position of predecessor. project includes animation of 4 images in same time many position sequence.

assembly - How many levels of pipelining can be acomplished with modern CPUs vs GPUs? -

i red in these slides gpus typically have deeper pipelining cpus. gpus have deeper pipelines (several thousand stages vs 10-20 cpus) i find more numbers tried googling , wasn't able find any. noticed wikipedia article noted pentium 4 prescott pipelined. qualitatively speaking, how pipelining can have more 3 levels? considering fetch/decode/execute cycle, that's 3 things? there's multiple functional units, example there more 1 decoders more 1 instruction can decoded @ time? how can more 1 thing red memory @ once? please remember include numbers regaurding levels of pipelining in answers. well, let's start end: how can more 1 thing read memory @ once? it is. processor 64 bit data bus doesn't read byte @ time memory, reads 8 bytes @ time. besides, decoding instructions isn't limited 1 memory read. is there's multiple functional units, example there more 1 decoders more 1 instruction can decoded @ time? some proce

r - Remove Bars with Small Counts from Bar Chart in ggplot2 -

i make bar chart factor lots of levels. exclude factors have small number of occurrences. can making new data frame, there way ggplot2 internally? i have tried using limits, ..count.., etc. here example: #### has 4 levels remove bins 1 observation ### df<-data.frame(x=as.factor(c(rep("a",4),rep("b",5),rep("c",2), rep("d",1)))) p<-ggplot(df)+geom_bar(aes(x)) ###### gives correct thing, had make new data frame ###### new.df<-subset(df, x%in%levels(df$x)[table(df$x)>1]) p<-ggplot(new.df)+geom_bar(aes(x))

c# - Count of tokens in string -

i wondering why following code returns 1 instead of 2. clue? in advance. string report = "foo bar foo aloha hole hole foo cat gag weird gag strange tourist"; string name = "hole"; int count = regex.matches(report, @"(^|\s)" + regex.escape(name) + @"(\s|$)").count; console.writeline("count " + c); if you're trying learn regex , cool, disregard this. otherwise, regex overkill that's simple using other methods (like linq ): var count = report.split().count(x => x == name);

wordpress functions dosn't work -

i have form grabs data users , save blog post. the form action goes page: wp-content/plugins/formplugin/savepost.php but in page when try save post wp_insert_post($args) , error happens: "call undefined function wp_insert_post() in d:\easyphp-5.4.0rc4\www\wp2\wp-content\plugins\formplugin\savepost.php on line 18". is there missing? if(isset($_post['send'])){ $args=array( 'post_name' => $_post['postname'], 'post_title' => $_post['postname'], 'post_status' => 'publish', 'post_type' => 'post', 'post_excerpt' => $_post['postdesc'] ); wp_insert_post($args); } include wordpress in external files: it looks using external file outside scope of wordpress. if file in plugins folder, doesn't mean wordpress knows it. you can include wordpress external file adding this: <?php de

Select multiple columns from a table and insert data into another table in a different database in PHP-MySQL -

Image
i have select data table in database , insert them table in different database. below code returns $select_query ok, $insert_query not ok. please correct code , let me know response? $host1 = "localhost"; $user1 = "jackpot"; $pass1 = "jackpot"; $db1 = "pinkapple"; $host2 = "localhost"; $user2 = "jackpot"; $pass2 = "jackpot"; $db2 = "blueberry"; $mysql_connection1 = mysql_connect($host1, $user1, $pass1); mysql_select_db($db1, $mysql_connection1) or die(mysql_error()); $select_query = mysql_query("select field1, field2, field3 tree date_entered > '2014-01-01 16:22:00'", $mysql_connection1); $number = mysql_num_rows($select_query); if ($select_query) { echo "select query ok <br>"; echo $number ."<br>"; } else { echo "select query not ok <br>"; } $mysql_connection2 = mysql_connect($host2, $user2,

android - HttpsURLConnection setDoOutput(true) isn't working -

so writing android app tweets particular user, using twitter's 1.1 application-only-auth , requires post http request bearer token. have method set uses httpsurlconnection open connection, but conn.setdooutput(true); method isn't working conn.dooutput stays false the request stays default get . am doing wrong? this method called in asynctask 's doinbackground() method: public string getrequestbearertoken(string endurl) throws ioexception { string encodedcred = encodekeys("api-key", "api-secret"); httpsurlconnection connection = null; try { url url = new url(endurl); connection = (httpsurlconnection) url.openconnection(); connection.setinstancefollowredirects(false); connection.setdoinput(true); connection.setdooutput(true); connection.setrequestmethod("post"); // post request properties connection.setrequestproperty("host", &quo

sql - How to update data for each row using function and data from another table? -

i've got problem updating data each row in acrticles_pl_vector table using function in set clause , data take table. for example have pseudocode: create or replace function updatetsvector () returns status $$ begin each row othertable update acrticles_pl_vector set vector = to_tsvector('polish', othertable.title || othertable.content); id = othertable.id end; $$ language plpgsql thanks in advance! create or replace function updatetsvector () returns void $$ update acrticles_pl_vector set locale = 'pl', vector = to_tsvector('polish', ot.title || ot.content othertable ot id = ot.id; $$ language sql;

c++ - Can I include a library as a static library and compile it inside a iOS project? -

i'm programming c++ library going used .net, android , ios. noticed external libraries apple may reject final app. it possible compile included library (like boost, libcurl, sqlite3, etc) static library , able publish ios app c++ library (which include libraries)? there should no problem linking static library in project. apps using dynamic libraries rejected apple. can build dynamic libraries ios , load them @ runtime?

ios - Use sizeToFit with lineSpacing -

i have uilabel several lines. text set dynamically, , label height too, native method : [mylabel sizetofit]; i have other method sets line spacing in label : nsmutableattributedstring *attributedstring = [[nsmutableattributedstring alloc] initwithstring:@"my long dynamic text"]; nsmutableparagraphstyle *paragraphstyle = [[nsmutableparagraphstyle alloc] init]; [paragraphstyle setlinespacing:5]; [attributedstring addattribute:nsparagraphstyleattributename value:paragraphstyle range:nsmakerange(0, [labeltext length])]; mylabel.attributedtext = attributedstring; the problem if set line spacing first, , call sizetofit , new height of label small. doesn't take in count line spacing. it problem label in uiscrollview , need right height. for getting size of label dynamically based on text length use method: /*! returns size of label display text provided @param text string displayed @param width width required d

java - Android Clear Data programmatically -

following answer https://stackoverflow.com/a/19831167/2956344 i try clear data package. when try clear data have null pointer exception in line : ... if (appdir.exists() && appdir.isdirectory()) { string[] children = appdir.list(); (string s : children) { // npe! children null if (!s.equals("lib")) { deletedir(new file(appdir, s)); toast.maketext(this, "app data deleted", toast.length_long) .show(); } } } ... file-explorer tool show me folder contains files. , confusion this. tell me what's wrong? the array empty if directory empty. returns null if abstract pathname not denote directory, or if i/o error occurs.is there i/o error happening?

visual studio - How do I test an Azure Internal Endpoint from a local dev client? (Test in Production) -

the big question: how ip:port of internal endpoint local dev client not running inside roleenvironment? if connect azure network, test class in vs (where trying execute tests calls service directly) cannot make use of roleenvironment.roles["myrole"].instances; , because in , of itself, not running in azure role. the setup: i have backend web services (web api) internal endpoints in deployment/role. front end website uses these services. i have dev employee needs run tests against internal endpoints using vs (unit tests) i not have on-premise network (small company, works home, no active directory per se, no domain server handling windows auth, have o365 accounts). the requirements: i need local client (not running inside roleenvironment) connect azure (vpn?) get location (ip:port) of endpoint the developer accessing azure network should have access these services, not entire box within azure (i.e. not admin in remote desktop, nor admin of azure por

Is there a "Space(n)" method in C#/.Net? -

i'm converting ancient vb6 program c# (.net 4.0) , in 1 routine lots of string manipulation , generation. of native vb6 code uses have analogues in c# string class, e.g., trim() . can't seem find replacement space( n ) , apparently generates string n spaces. looking through msdn documentation, there seems space() method vb.net couldn't find mentioned outside of vb.net context. why this? thought .net languages share same clr. does c# or .net have generic space() method can use in c# i'm overlooking somewhere? n.b. i'm aware writing one-liners generate n-spaces popular quiz-question , programmers' bar-game programming languages, i'm not looking advice on that. if there's no native way in c#/.net it's easy enough write simple method; don't want reinvent wheel. use constructor on system.string : new string(' ', 10); http://msdn.microsoft.com/en-us/library/xsa4321w(v=vs.110).aspx here's neat extension

user interface - iOS side menu library with left, right and bottom transitions -

in ios app, need side menu left, right , bottom transitions. i know pprevealsideviewcontroller . do know alternative? i implemented 1 of these, might helpful. https://github.com/john-lluch/swrevealviewcontroller

javascript - Canvas: draw lots of elements with a changing gradient (emulate angular gradient) -

Image
for project http://biduleohm.free.fr/ledohm/ (sorry, user interface in french code in english) need angular gradient doesn't exists in native i've implemented using linear gradient on line , draw lines more , more longer form triangle. result graphically ok speed isn't (1850 ms 125 triangles). it's in tab [répartition], redraws if there keyup event on 1 of inputs, don't afraid of apparent slowness, i've limited maximum 1 redraw every 2000 ms. before used simple linear gradient on whole triangle (but doesn't match reality) , speed ok, draws thousands of triangles in less second. function used : drawfrontlightforcolor : function(x, y, w, h, color) { var x2 = x - w; var x3 = x + w; var gradient = distri.frontcanvas.createlineargradient(x2, y, x3, y); gradient.addcolorstop(0, 'rgba(' + color + ', ' + distri.lightedgealpha + ')'); gradient.addcolorstop(0.5, 'rgba(' + color + ', ' + (color == d

ruby on rails - Creating a token with encryption -

i using rails api backend of iphone app. users need able sign in on rails side creating remember_token, sending app in header, , encrypting token on rails side. on, whenever post request made app, sends token it. things creating photo on app, need find user sending request. this, using listed bellow. problem remember_token being sent phone different 1 being saved rails. example: 1 save phone: cknqijl5ecapewup_px4rw token saved user on rails: e18f05d5e7260cc70dde4e68c590dde4bd2d2b04 here how create token: def user.new_remember_token securerandom.urlsafe_base64 end def user.hash(token) digest::sha1.hexdigest(token.to_s) end when user created or signed in: remember_token = user.new_remember_token @user.update_attribute(:remember_token, user.hash(remember_token)) response.headers['x-token'] = remember_token finding user through token when needed: @key = request.headers['x-token'] @user = user.find_by_remember_token(@key) error message: nomethoderro

graph - Does Dijkstra's algorithm give shortest path always? -

i learning dijkstra's algorithm , had basic query. have graph looks follows..(non-negative nodes): a---2-----b------16------d-----3-------f * * * * 3 4 * * c----------2---------------------------e not clear above graph display, ac has distance of 3 , ef has distance of 4. i interested in finding shortest path between , f. consider destination node f. when consider nearest node, d (df has weight 3 , ef 4). however, when follow path, shortest path as: a,b,d,f (total distance: 19). a quick observation tells shortest path a,c,e,f (distance: 9). however, since in 1st step, e more distant d, followed d. am missing here? dijkstra's algorithm not showing right result here. yes dijkstra's gives shortest path when edge costs positive. however, can fail when there negative edge costs.

How to disable SEO for my website? -

people struggle increase seo of websites, same other websites, studying seo training videos, reading blogs seo. but website made school need reverse, want website not listed in of search engines, because website intended used school's staff , students have direct link website. the safest method if want hide website public (world) password protect it, if want disable seo website use following meta tag: <meta name="robots" content="noindex, nofollow"> you can use robots.txt file in site's root containing following content: user-agent: * disallow: / it should noted search engines indexing site whether honor robots.txt ; not obliged to.

ios - UICollectionViewCell unrecognized selector sent to instance -

i have created uicollectionviewcell looks this #import "photocell.h" @implementation photocell @synthesize imageview; - (instancetype)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { self.backgroundcolor = [uicolor clearcolor]; imageview = [[uiimageview alloc] initwithframe:(cgrect){.origin = cgpointmake(4.0f, 4.0f), .size=cgrectinset(frame, 4.0f, 4.0f).size}]; imageview.autoresizingmask = uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight; [self.contentview addsubview:imageview]; } return self; } @end i calling 1 of view controllers trying set uicollectionview.. calling class - (uicollectionviewcell *)collectionview:(uicollectionview *)cv cellforitematindexpath:(nsindexpath *)indexpath; { photocell *cell = (photocell *)[self.photocollectionview dequeuereusablecellwithreuseidentifier:@"cell" forindexpath:indexpath]; nsdictionary *currentphotodict

javascript - How to add popup window in Google maps when a marker is clicked -

i trying build dynamic google map using jquery json , php, how managed complete map listing using following code example: <script type="text/javascript"> // root path data directory var dataroot = 'gmap-master/'; // data file markers (could php file dynamic markers) var newdate = new date; var markerfile = dataroot + 'ammap.php'; // set default map properties var defaultlatlng = new google.maps.latlng(49.00, 10.00); // zoom level of map var defaultzoom = 2; var ndefaultzoom = 2; // variable map var map; // variable marker info window var infowindow; // list marker check if exist var markerlist = {}; // set error handler jquery ajax requests $.ajaxsetup({"error": function(xmlhttprequest, textstatus, errorthrown) { alert(textstatus + ' / ' + errorthrown + &#