Posts

Showing posts from February, 2013

Passing an Array as Arguments NOT user function, in PHP -

i have following code: $bin = "\x04\x00\xa0\x00\x04\x00\xa0\x00"; $unpack_data = unpack("c*", $bin); $arr = array($unpack_data[1], $unpack_data[2], $unpack_data[3]); how can pass array $arr pack() function? thing can make: $res = pack("c*", $unpack_data[1], $unpack_data[2], $unpack_data[3]); but length , content of array getting in course of program. like this: call_user_func_array('pack', array_merge(['c*'], $unpack_data))

asp.net - Could not load file or assembly 'Oracle.ManagedDataAccessDTC.DLL' or one of its dependencies -

we have asp.net 4.5.2 application using latest oracle.manageddataaccess.dll nuget entity framework 5. file version: 4.121.1.0 product version: 4.121.1.20131211 when deployed production environment (windows server 2008 r2 x64) works fine, until need distributed transactions. oracle documentation states need provide oracle.manageddataaccessdtc.dll (of same version, specific platform x64) in order distributed transactions working. could not load file or assembly 'oracle.manageddataaccessdtc.dll' or 1 of dependencies. specified module not found. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.io.filenotfoundexception: not load file or assembly 'oracle.manageddataaccessdtc.dll' or 1 of dependencies. specified module not found. stack trace: [filenotfoundexception: not load file or assembly 'oracle.manageddataaccessdtc,

linux - Pecl / Python: unsupported locale setting - Ubuntu 13.10 -

i want install pecl ssh2 extension. when try: sorry, command-not-found has crashed! please file bug report at: https://bugs.launchpad.net/command-not-found/+filebug please include following information report: command-not-found version: 0.3 python version: 3.3.2 final 0 distributor id: ubuntu description: ubuntu 13.10 release: 13.10 codename: saucy exception information: unsupported locale setting traceback (most recent call last): file "/usr/lib/python3/dist-packages/commandnotfound/util.py", line 24, in crash_guard callback() file "/usr/lib/command-not-found", line 69, in main enable_i18n() file "/usr/lib/command-not-found", line 40, in enable_i18n locale.setlocale(locale.lc_all, '') file "/usr/lib/python3.3/locale.py", line 541, in setlocale return _setlocale(category, locale) locale.error: unsupported locale setting i'v tried everything, yes found on google! what i'v tried: 1- on t

Angularjs: is this the correct way to use controller and directive? -

normally directive use data in scope, example: <div my-directive data-x='x' data-y='y' data-z='z' ...> </div> however, arguments of directive grow fast. put them in model class. each of directive has it's own model class. <div my-directive data-model='mydirectivemodel'> </div> in controllers, need set $scope.mydirectivemodel = { x: 100. y: 200, add: function(){ return this.x + this.y; } }; is correct way use controller , directive? it's cleaner way of passing data through directive having lots attributes in markup. however suggest 1 of things angular it's declarative syntax. if , exclusively you've suggested, when come read markup in couple of months you'll have delve code see what's going on. being more explicit in markup save time. example when this: <div my-directive show-chickens="yes" chimp-count="monkeys

c# - Why does ReadAllLines work in WPF but not in ConsoleApp -

i doing benchmarking on different ways read csv file , found "wierd" problem. problem being when use method in console application: var lines = file.readalllines(filename); // outofmemoryexception foreach (var line in lines) { //doing stuff } i outofmemoryexception, when use same method in wpf project works fine. file im testing on 730mb , know not use readalllines on bigger csv files why method work in wpf application not in console application? you're using 32 bit process , suffering address space fragmentation. means runtime cannot allocate enough contiguous memory, although in total, enough memory free. wpf might tend have better memory layout. change project 64 bit. or, stream file using file.readlines .

javascript - How to make a non-displayed input or its label `keyboard tab stoppable`? -

to have customized input file , i've made hidden by: input[type="file"]{display:none;} and have put background label : label.uploadfilelabel {background-image:url(../image.jpg);} this approach works fine, has introduced problem: keyboard tab not stop on button , label. tried using tabindex="0" no result. there way stop keyboard tab on hidden button? of course, prefer pure css solution, javascript solution (without jquery ) acceptable. thanks sharing update: here fiddle of problem . tested, works in ie , firefox not in chrome you should try this. works, keep in mind html5. <input type="file" tabindex="-1">

ios8 - `CLLocationManager requestWhenInUseAuthorization` perform action after the user accepts -

ive update app include [cllocationmanager requestwheninuseauthorization] . possible start update after user gives permission? in ios7 use users location when view loads, there 1 step , result method not using valid latitude , longitude. the solution perform action in cllocationmanager delegate method ; // location manager delegate methods - (void)locationmanager:(cllocationmanager *)manager didupdatelocations:(nsarray *)locations this method gets called after user gives permission use location services. or if user has given access automatically called. if want call method once can do: // location manager delegate methods - (void)locationmanager:(cllocationmanager *)manager didupdatelocations:(nsarray *)locations{ cllocation *location = [locations lastobject]; if(location !=nil){ //we got location //<your method goes here> [manager stopupdatinglocation]; } }

c - linux mkdir function can't authorize full permission -

i testing mkdir function create new directory: folder = mkdir("./linux", 511); or folder = mkdir("./linux", 0777); or folder = mkdir("./linux", s_irwxu | s_irwxg | s_irwxo); as can see, try authorize full permission directory here's comes ls -l | grep linux : drwxr-xr-x 2 manuzhang manuzhang 4096 2012-01-04 06:53 linux why can't authorize write permission group , others? updates : weird thing, guys told me tried umask . works either umask(s_iwgrp) or umask(s_iwoth) fails umask(s_iwgrp | s_iwoth) , ideas? from man 2 mkdir : the argument mode specifies permissions use. modified process's umask in usual way: permissions of created directory (mode & ~umask & 0777). i suggest @ umask - set 0022 . try chmod post- mkdir .

hadoop - Can someone explain unique coprocessor execution behavior we are noticing? -

our environment : we have 44 region servers, the table has 572 regions, each region server has 13 regions each region has anywhere between 40k 110k records each region server 32 core/190gb ram my issue when run coprocessor runs on these regions radically different execution time on regions of single region server. for e.g. 1 region took 3.9 seconds whereas took 8.9 seconds on same region server same no. of rows. is normal behavior? region coprocessor execute under single jvm or each region has own handler in own jvm? what significance of hbase.regionserver.handler.count ? set 100. mean 100 threads in single jvm or multiple jvms? got answers of questions: is normal behavior? region coprocessor execute under single jvm or each region has own handler in own jvm? all regions handled single jvm process. what significance of hbase.regionserver.handler.count ? set 100. mean 100 threads in single jvm or multiple jvms? this max no. of threads spun in

javascript - how to remove the powered by Sailsjs from the app -

i know file exists here linkto file but there effective way remove header ? in config files or ? please see header access-control-allow-origin →* connection →keep-alive content-encoding →gzip content-length →1189 content-type →text/html; charset=utf-8 date →fri, 19 sep 2014 20:30:24 gmt etag →"-514643591-gzip" keep-alive →timeout=5, max=200 server →apache/2.4.7 (ubuntu) php/5.5.9-1ubuntu4.4 openssl/1.0.1f vary →accept-encoding x-powered-by →sails <sailsjs.org> i want remove x-powered-by thanks in http.js config file comment out line poweredby . see http://sailsjs.org/#/documentation/anatomy/myapp/config/http.js.html

joomla - List of users who registered in the same month as the logged user -

i need create custom module shows list of users registered in same month logged user. you have start learning how create joomla module . then familiar joomla database functions . once create module, have active user using current user object . next step run query #__user_profiles table active user register date. query like: select `registerdate` `#__user_profiles` `username` = $user_id and run second query users registered same month active user: select `username` `#__user_profiles` month(registerdate) = month($current_user_register_date) good luck!

NullPointerException with a bank account in Java -

i exception when try create new customer in bank account program: exception in thread "main" java.lang.nullpointerexception @ bank.program.customer.addaccount(customer.java:18) @ bank.program.bankprogram.main(bankprogram.java:24) java result: 1 what mean, , need change rid of it? bank class: public class bank { string bankname; private arraylist<customer> customers = new arraylist<customer>(); bank(string bankname) { this.bankname = bankname; } public void addcustomer(customer newcustomer) { customers.add(newcustomer); } } account class: public abstract class account { protected double balance = 0; protected string accountid; public account() {} //defaultkonstruktor public account(double bal, string id) { //konstruktor if (balance >= 0) { balance = bal; } else { balance = 0; } accountid = id; } pu

Using PromptforLetter and DisplayLetter in C# -

below homeowrk assignment i've been working on. i need create class called formattedoutput in file called formattedoutput.cs. class have following methods: char promptforletter(void) - method return value void displayletter(char letter) - method accept value display main should in file named mainmodule.cs main promptforletter each character in name , store each character char data type. then displayletter(letter1) should display each letter as: the actual letter decimal value of key hexadecimal value of key octal value of key binary value of key information should displayed first... prompts each letter of name. table showing each value char decimal hex octal binary here horrible mess have @ time using system; using system.collections.generic; using system.linq; using system.text; namespace consoleapplication1 { public class formattedoutput { char promptforletter(string prompt) { st

freepascal - How to eliminate Free Pascal 'not recognized' compile error on TFileStream? -

i using free pascal 2.6.4 32-bit on windows 8.1. want use tfilestream copy file. program copy; procedure copyfile (strfilename : string); var sourcef, destf : tfilestream; begin end; begin writeln('starting '); end. the compiler not recognizing tfilestream: fpc copy_small.pas free pascal compiler version 2.6.4 [2014/03/06] i386 copyright (c) 1993-2014 florian klaempfl , others target os: win32 i386 compiling copy_small.pas copy_small.pas(5,33) error: identifier not found "tfilestream" copy_small.pas(5,33) error: error in type definition copy_small.pas(12) fatal: there 2 errors compiling module, stopping fatal: compilation aborted error: c:\fpc\2.6.4\bin\i386-win32\ppc386.exe returned error exitcode (normal if did not specify source file compiled) the sample code found on web using tfilestream did not have "uses" clause. there needs set on command line or included in program in order use tfilestream free pascal? tfilestream live

Can two users connected to a DB and update the same row of a table simultaneously in SQL server? -

can 2 users connected db , update same row of table simultaneously in sql server? for example, user , user b logged in same db simultaneously , begin new transactions , update weekly rent simultaneously. the original weekly rent $300/pw. user a: update rent set weeklyrent = weeklyrent* 1.1 address ='121 green' user b: update rent set weeklyrent = weeklyrent* 1.2 address ='121 green' then user issues commit statement. user b issues commit statement. what final rent price? $330 or $360 or $300? i've researched , seems data won't change because of 'deadlock'. please correct me if i'm wrong. in advance~ sql server lock table/row/page ensure able update. talking milliseconds in cases impossible them "simultaneously" updating same record. sure use transaction , limit connection times because record locked until transaction ends.

node.js - Node oracle returns "UnKnown Error " with select statements -

i trying use node-oracle package application select statement returns "unknown error". i able create table connection object without error fails select statement. have seen similar issue filed in node -oracle forum , there no answer issue created. using oracle express server locally on windows 8 machine . i have spent lot of time trying play around roles of oracle account/schema using has not helped. able connect using sample dot net application without error , execute select statement . any suggestion on how @ least figure actual error helpful . thanks in advance. edit : able confirm error in node oracle module , not sure why see . effort contain error in try catch block in c++ connection.cpp file not working . stuck . not sure if if has windows 8 machine .

Mule ESB: How to take all the files in a folder inside Bucket of Amazon S3 ( get object content) -

i'm using amazon s3 , bucket have mutiple files in input folder.i need take files in folder , process it, right can able take 1 file , process providing key value. not sure how take files in bucket (input folder name in bucket) @ 1 shot. please find config below <s3:config name="amazon_s3" accesskey="mykey" secretkey="mysecretkey" doc:name="amazon s3"/> <flow name="s3flow1" doc:name="s3flow1"> <http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8081" doc:name="http"/> <logger message="*********inside yes************" level="info" doc:name="logger"/> <s3:list-objects config-ref="amazon_s3" bucketname="getfiles" doc:name="amazon s3" maxkeys="5" delimiter="/" prefix="input/"/> <json:object-to-json-transformer doc:name=&q

java - Apache Shiro authc.loginUrl no redirect to my jersey services after login -

i want secure jersey jax-rs services apache shiro security with out jsp not working. when use browser test services server redirect me login page expected , when insert username , password , press submit button the server not redirect me service after login . i getting error: http error 404 problem accessing /rest/hello/some_text. reason: not found powered jetty:// the code working on can download here https://github.com/javajack/shiro-jersey.git , sub project "jersey-sample" modified shiro.ini , change the: "authcbasic" "authc". i test browser: url: localhost:port/rest/hello/some_text what missing ? the following configuration: shiro.ini: [main] authc.loginurl = /connect.html [users] root = secret,admin guest = guest,guest presidentskroob = 12345,president darkhelmet = ludicrousspeed,darklord,schwartz lonestarr = vespa,goodguy,schwartz [roles] admin = * schwartz = lightsaber:* goodguy = winnebago:drive:eagle5 [urls] /connect.ht

c - Printing only one combination using nested loops -

i have print combination of different currency notes man should have pay cashier. program first ask total amount paid , notes of different denominations possesses. problem is, have print 1 combination of currency notes, getting combinations (as usual) following code. #include <stdio.h> int main(void) { int hundred,fifty,ten,total,hund,fif,t; printf ("enter amount paid:"); scanf ("%d",&total); printf ("\n\nhow many currency notes have?\nenter 100,50 , 10 rupee notes respectively:\n"); scanf ("%d %d %d",&hund,&fif,&t); printf ("\t\t\tpossible combination rs=%d/- \n",total); (hundred=0; hundred<=hund; hundred++) { (fifty=0; fifty<=fif; fifty++) { (ten=0; ten<=t; ten++) { if ((hundred*100+fifty*50+ten*10)==total) { printf("\n\n hundred rupees notes=%d, 50 rupees notes=%d, 1

javascript - Check for unseen posts and update title -

i need check wether user has seen post , change document title based on how many posts hasn't seen. for example title 2 unseen posts: "(2) - post#123", or no unseen posts: "post #123". i've looked couple of "scrolled view" jquery plugins, haven't found , quick solution ajaxed content (the posts appended div, checks new every 5 seconds). so example markdown: <div id="posts"> <div class="reply" data-postid="1" data-seen="no"> post 1 </div> <div class="reply" data-postid="2" data-seen="no"> post 2 </div> <div class="reply" data-postid="3" data-seen="no"> post 3 </div> </div> i'm guessing using attribute "seen" useful. how check if user has seen (the posts have been scrolled by/on screen) , store unseen in string use in title? useful info: divs appended gotten via

php - Check if username exists in one database -

<? $objconnect = mysql_connect("localhost","easyuser1","pass") or die(mysql_error()); $objdb = mysql_select_db("easyuser1"); $strsql = "select * user idnumber = '".$_post["id_number"]."' "; $objquery = mysql_query($strsql); $objresult = mysql_fetch_array($objquery); if($objresult) { $con=mysqli_connect("localhost","easyuser2","pass2","easyuser2"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $name = mysqli_real_escape_string($con, $_post['name']); $last_name = mysqli_real_escape_string($con, $_post['last_name']); $id_number = mysqli_real_escape_string($con, $_post['id_number']); $times = mysqli_real_escape_string($con, $_post['times']); $branch = mysqli_real_escape_string($con, $_post['branch']); $branch_address = mysqli_real_escape_string($con, $_po

Swift generic operator -

i wrote class one: struct size { var width:double=0 var height:double=0 init(width:double=0,height:double=0) { self.width=width self.height=height } [...] } now want ability divide size number, , use generics function each type convertible double. example int , cgfloat , float but when insert function: func /<t>(lhs:size,rhs:t)->size { return size(width:lhs.width/double(rhs),height:lhs.height/double(rhs)) } i error error: cannot invoke 'init' argument list of type '(width: double, height: double)' return size(width:double(lhs.width/rhs),height:double(lhs.height/rhs)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ that weird because list passed of exact types defined in class (double).. if rewrite in way: func /<t>(lhs:size,rhs:t)->size { let drhs=double(rhs) return size(width:lhs.width/drhs,height:lhs.height/drhs) } then error: error: c

c - Objective of solution in original space during solution reading -

i read solution in original problem space during initsolve stage. multi-aggregated variables ignored. guess okay since values can inferred once other variables' values fixed. however, objective value of read solution off.. since objective multi-aggregated variables not included.. there anyway around this? the objective coefficients of multi-aggregated variables added variables of active representation, objective value of solution should still correct. however, can happen multi-aggregation done dual argument, i.e., there might solutions multi-aggregated variable set different value, can still set value given multi-aggregation without deteriorating objective. moreover, presolving might change bounds or fix variables based on type of argument well. in case, solution might not "fit" presolved problem, "adjusted" solution value not worse original solution. case? objective value of solution better? moreover, should check objective function value of

postgresql - pgAgent scheduled job failed on Windows -

i trying set step batch file path on particular time in pgagent via pgadmin. when run failing , in step statistics got output c:\windows\system32>c:\postgresql\run.bat 'psql' not recognized internal or external command, operable program or batch file. details: postgresql 9.3.5 on local system account (current user) pgadmin 1.18.1 pgagent via stack builder administrator account (current user) in run.bat have 2 statement @echo off psql -h localhost -p 5433 -u postgres -d test -a -f "test.sql" i have psql in system path variable , able access in cmd. when run bat file manually executing without fail. when given batch file path (c:\postgresql\run.bat) in pgagent jobs giving error in statistics. is there wrong in configuration? why going c:\windows\system32> ? edit: my run.bat file @echo off set lbsdatabasename=test set dbhost=localhost set dbport=5434 set dbuser=postgres set logfile=dbinstall.log set sqlfolder="d:\sourc

Running a python program from a C++ program? -

i've been messing around selenium in python, , want have existing c++ program run python code. basically, python code finds website, , downloads file afterwards c++ program wants open file , bunch of operations on it. if had mypythoncode.py file, , other c++ files (header.h, main.cpp, otherfunctions.cpp...) how go running python code c++ program? also both of programs console programs, , hoping user have uninterrupted experience running program (for example, if user wants download file while running c++ program terminal doesn't have close, or open different window start python program). in going appreciated! it operating system specific, , c++11 standard not define functions (except system(3) , in c99, , std::system in c++11). on linux (and other posix systems), read advanced linux programming , consider using system , or popen(3) , or more lower-level syscalls(2) fork(2) , execve(2) , pipe(2) , dup2(2) , etc etc.... may want ipc , may need have event loo

I am trying to run R scripts in C# with the below code snippet. But the output gets repeated -

process cmdprocess = new process { startinfo = { filename = "cmd.exe", workingdirectory = "c:/program files/r/r-3.0.2/bin", arguments = " /c r --slave --args $@ ", useshellexecute = false, redirectstandardoutput = true, redirectstandarderror = true, redirectstandardinput = true, createnowindow = true, } }; cmdprocess.start(); cmdprocess.beginoutputreadline(); foreach (var item in file.readalllines(“audit.r”)) { cmdprocess.standardinput.writeline(item); cmdprocess.outputdatareceived += cmdprocess_outputdatareceived; } } and try output using following event. public void cmdprocess_outputdatareceived(object sender,datareceivedeventargs e) { this.resulttext += e.data + &q

c# - US States Drop Down List - need State Name Header to Show -

i'd display state name header on results page. here's gets tricky , maybe i'm going wrong. i using state abbreviation/id value query users use applicationdbcontext , state value stored in table abbr. (not name). can see below in controller block, trying new query main db context pull state name , store in viewbag. when select state , enter works should viewbag.nameofstate displays this: select [extent1].[id] [id], [extent1].[stateabbr] [stateabbr], [extent1].[statename] [statename] [dbo].[stateorprovinces] [extent1] ([extent1].[stateabbr] = @p__linq__0) or (([extent1].[stateabbr] null) , (@p__linq__0 null)) controller: public actionresult shopsus(string id) { applicationdbcontext shopdb = new applicationdbcontext(); var statelist = shopdb.users.where(s => s.state == id).orderby(s => s.city); //second db query state name header display if (statelist != null)

How do I install playbin2 plugins for gstreamer on windows -

i trying run tutorials gstreamer proposed here , running the problem described here .my case have not plugins playbin2 installed .my problem how them installed? have downloaded , installed gstreamer( devel version ) , have linked against libraries suggested here can't find related playbin2 .can suggest way can make application aware of playbin2 plugins? thank time. if @ gstreamer.com, there notice on top of page referring official gstreamer project page -> gstreamer.freedesktop.org. these tutorials 0.10 version obsolete , unmantained. example, in 1.0 playbin2 renamed playbin. i'd recommend getting official 1.0 releases directly gstreamer.freedesktop.org , starting there.

jquery - How to get boundary value of rect tag in svg using javascript -

Image
i working in svg editor 2.7 version,here need selected individual boundary value of rectangle in svg using javascript. <svg width="9000" height="100" style="border:1px solid black"> <rect x="9000" y="0" height="100" width="200"></rect> </svg> my rectangle getting selected tool.but need select individual corner of rectangle below images in svg edit files contain mousedown,mousemove , mouseup event.here used getbbox() function boundary value. need split boundary selection above image 2. here working on mouseover event getting boundary of rectangle in svg. didn't achieve it. kindly guide me or drag me right way. var mouseover = function(evt) { evt.preventdefault(); var root_sctm = $('#svgcontent g')[0].getscreenctm().inverse(); var pt = svgedit.math.transformpoint( evt.pagex, evt.pagey, root_sctm ), mouse_x = pt.x * current_zoom,

web services - com.ibm.ws.webcontainer.exception.WebAppNotLoadedException when deploying into WAS8.5.5? -

i have developed 1 web-services application using spring boot , when trying deploy websphere 8.5.5 throws following exception. [9/22/14 1:24:54:194 cdt] 00000097 systemerr r slf4j: class path contains multiple slf4j bindings. [9/22/14 1:24:54:194 cdt] 00000097 systemerr r slf4j: found binding in [wsjar:file:/c:/users/ac99534/webspher8.5.5_instal/profiles/appsrv01/installedapps/vdaasw700793node02cell/soa-clm-hipaa-inq-ear.ear/soa-clm-hipaa-inq-war-1.0.0-snapshot.war/web-inf/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/staticloggerbinder.class] [9/22/14 1:24:54:194 cdt] 00000097 systemerr r slf4j: found binding in [bundleresource://267.fwk-19140409:1/org/slf4j/impl/staticloggerbinder.class] [9/22/14 1:24:54:195 cdt] 00000097 systemerr r slf4j: see http://www.slf4j.org/codes.html#multiple_bindings explanation. [9/22/14 1:24:54:287 cdt] 00000097 systemerr r slf4j: actual binding of type [ch.qos.logback.classic.util.contextselectorstaticbinder] [9/22/14 1:24:55:

javascript - Truncate text to fit in 3 lines and show three dots in end In Html -

i need display text paragraph, display 3 lines , truncate test while adding ...(three dots) in paragraph end. calculate max length of string can fit 3 lines , use following script var maxlength = 140; var result = yourstring.substring(0, maxlength) + '...';

ruby - First argument in form cannot contain nil or be empty - user sign up form - rails 4 -

i'm trying create basic login/sign form in rails 4 , keep getting error "first argument in form cannot contain nil or empty" @user. part doesn't this: <%= form_for @user |f| %> but have 'new' method in controller, problem people seem have ask error: class userscontroller < applicationcontroller def new @user = user.new end can please help? addendum: changing <%= form_for user.new do doesn't work either... your form looking instance of class, in case user in order (i.e. create new 1 or edit existing one). in order allow users register on index page (which wouldn't recommend - breaks restful design) need have in userscontroller class userscontroller < applicationcontroller def new @user = user.new end def index @user = user.new end

Java Executor in timerange at specific time -

i need call task every x hour in defined time range , repeat every day. idea calculate executions times delay current time , start each in seperated thread via scheduleatfixedrate , rate of 24 hours. has better idea? regards you can use library dedicated schedule code: quartz it use cron syntax , can schedule job implementations.

c# - Upload a text file with Azure Mobile Services -

i want create application user after authentication can upload file(txt/xml etc.) using azure mobile services , after can download files uploaded himself. i've watched lot of tutorials (including one: link ) in case inserts row database table. want same thing, files. how can that? i'm new this, i'm guessing, should upload files blob storage, , store link in database pointing file? i'm searching best practice. yes, correct! limited in size if tried store text file field in database. http://azure.microsoft.com/en-us/documentation/articles/mobile-services-windows-store-dotnet-upload-data-blob-storage/ shows how want images. want change image stream text stream here: // new image stream. using (var filestream = await media.openstreamforreadasync()) { ... } and use stream classes instead open file stream: http://msdn.microsoft.com/en-us/library/windows/apps/system.io.stream(v=vs.105).aspx

javascript - RegEx Errors Not Displaying -

i have several text boxes in row on table , i'm not able see error message due this, @ present star (*) displaying isn't helpful end user. any ideas/solutions/fixes problem? below aspx code: <asp:textbox id="name" runat="server" text='<%#bind("name") %>'></asp:textbox> <asp:requiredfieldvalidator id="fieldvalidator" runat="server" controltovalidate="name" validationgroup="vg" setfocusonerror="true">*</asp:requiredfieldvalidator> <asp:regularexpressionvalidator id="regname" runat="server" controltovalidate="name" errormessage="* required, no more 20 characters allowed." validationgroup="vg" validationexpression="^[a-za-z''-'\s]{1,20}$">*</asp:regularexpressionvalidator> set validation summary on page , display error message. don't put between them i

ruby on rails - NameError - undefined local variable or method `favorites' -

i new ruby... getting name error in user.rb nameerror - undefined local variable or method `favorites' #<user:0x007fc0e19a8720>: activemodel (4.0.5) lib/active_model/attribute_methods.rb:439:in `method_missing' activerecord (4.0.5) lib/active_record/attribute_methods.rb:167:in `method_missing' app/models/user.rb:17:in `favorited' app/views/favorites/_favorite.html.erb:2:in `_app_views_favorites__favorite_html_erb__4203159933335848505_70233146456940' this user.rb file: class user < activerecord::base # include default devise modules. others available are: # :confirmable, :lockable, :timeoutable , :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable has_many :posts, dependent: :destroy has_many :comments has_many :votes, dependent: :destroy has_many :users, dependent: :destroy mount_uploader :avatar, avataruploader def role?(base_role)

css - Why does "left: 50%, transform: translateX(-50%)" horizontally center an element? -

i refactored of css , pleasantly surprised find easier way horizontally align absolutely positioned element: .prompt-panel { left: 50%; transform: translatex(-50%); } this works great! if element's width auto. however, not understand what's going on make work. assumption translatex modern, more performant means of moving element around, not appear case. shouldn't these 2 values cancel each other out? furthermore, why does .prompt-panel { left: -50%; transform: translatex(50%); } not show same result first code snippet? the css left property based on size of parent element. transform property based on size of target element. name: transform percentages: refer size of bounding box [of element style applied] http://www.w3.org/tr/css3-transforms/#transform-property 'top' percentages: refer height of containing block http://www.w3.org/tr/css2/visuren.html#position-props if parent 1000px wide , c

pdo - hide my div in php if jobs = 1 -

i trying hide div, if info = 1 here had b4 $sql = 'select id, start, work_id, nummer, left(job_art, 30) job_art godkend work_id = :work_id'; $q = $pdo->prepare($sql); $q->bindvalue(':work_id', $work_id); $q->execute(); $q->setfetchmode(pdo::fetch_assoc); ?> <?php while ($r = $q->fetch()): ?> <div class="liste"> <?php if ($r["info"] == 1){ echo'' ; } else { echo '<a href="visweb_godkend.php?work_id='.$r["work_id"]. '&amp;id='.$r["id"]. '&amp;nummer='.$r["nummer"].' " class="bluelink"><p class="padding"><span class="blacklink">'.$r["nummer"]. '</span>&nbsp;'.$r["job_art"]. '</p></a>'; } ?> </div> <?php endwhile; ?> <div class="buttomcorners&quo

c# - Saving multiple screenshots -

my goal capture screen shots of entire desktop. i have set timer 5 second interval testing purposes. i using code screenshots: int screenleft = systeminformation.virtualscreen.left; int screentop = systeminformation.virtualscreen.top; int screenwidth = systeminformation.virtualscreen.width; int screenheight = systeminformation.virtualscreen.height; using (bitmap bmp = new bitmap(screenwidth, screenheight)) { using (graphics g = graphics.fromimage(bmp)) { g.copyfromscreen(screenleft, screentop, 0, 0, bmp.size); } bmp.save(screenpath); } as screen path string screenpath = @"c://eventscout/screen " + datetime.now.tostring("yyyymmddhhmmss") + ".png"; everything working fine aside fact end 1 screenshot. what doing wrong? ideas, or leads? you need change file name saving on each iteration.

algorithm - Linearizing a DAG with multiple sources -

Image
i looking @ algorithms book, , see there simple algorithm linearize single source, directed acyclic graph deleting source nodes 1 one. can give me example why not work multiple sources? i assume "linearize" mean converting graph sequence of nodes one-to-one mapping, such full graph can recovered. a single-source dag directed forest. can linearize it, example, pre-order traversal , tree, starting each root sequentially. for example, graph: becomes (a (b c)) (e f g) . the problem general dags may have repeat same node more once: will become (a (b c)) (e (b c) f g) , , when reconstruct graph, may get: unless handle duplicates specifically. linearize (a (b c)) (e b f g) , solve problem remembering nodes reconstructed, though. anyway, suppose using node deletion algorithm, remove b here on first encounter, won't able reach e , , you'll (a (b c)) (e f g) wrong.

bash - Handbrake CLI Script Fixes -

i have simple script run convert videos using handbrake cli. love modify script if files convert original file deleted. here script stands: #!/bin/sh in=$1 out=$2 cd "$in" inputitem in *;do /path/to/handbrakecli -i "$inputitem" -o "$out/${inputitem}.mp4" -e x264 -q 20.0 -a 1,1 -e faac,ac3 -b 160,160 -6 dpl2,auto -r 48,auto -d 0.0,0.0 -f mp4 -4 -x 960 --loose-anamorphic -m -x cabac=0:ref=2:me=umh:b-adapt=2:weightb=0:trellis=0:weightp=0 done any ideas? you can check exit status of program. successful exit returns zero. to this, inside loop, after run, test exit status: if [ $? -eq 0 ] rm "$inputitem" fi