Daily Archives

Articles indexed Wednesday September 26 2012

Page 8/18 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Terminate function on System.in .. possible?

    - by Ronald
    I am currently working on a project where I have to make an agent to interact with a server. Each 50ms, the server will receive the last thing I outputted to System.out and send me a new set of lines as a 'state' through the System.in printstream to analyze and send my next message to System.out. Also, if the server receives multiple outputs from me, it only regards the most recent one. .. As for my question: My program originally constructed a tree and then analyzed each leaf node to see which would be optimal, and then waited around for the next input, but I can recursively do a deeper tree search that would make my output 'better' (and again and again to keep returning a better result). Using this and the fact that if the server receives multiple outputs, it only takes the most recent one, I could do each level, print my result and start the next level. But here comes my problem... I can't be stuck in some complex algorithm while I am supposed to receiving the next input as I will then miss it. So I was wondering if there is a way to cancel anything else I am doing when I receive something via System.in and then go back to the beginning of the function and start the search again with the new set of input (and rinse and repeat..) I hope this all makes sense, Thank ye all

    Read the article

  • mdx datediff error

    - by Roberto Durand
    select measures.name datediff("d", [Fecha].[Date].currentmember.member_value, [Dim Date].[Date].currentmember.member_value) on 1 from cube Error: Execution of the managed stored procedure datediff failed with the following error: Exception has been thrown by the target of an invocation.Argument 'Date1' cannot be converted to type 'Date' Is there any requirements to do datediff in mdx? In the dimension these member are defined as datetime, not sure if this influence in anyway the result...

    Read the article

  • CSS height doesn't work perfectly in firefox

    - by Shashank
    div.aboutstandard ul.aboutlist li { float: left; padding-left: 10px; padding-right: 10px; width: 300px; height: 280px; } div.aboutstandard ul.aboutlist li { float: left; padding-left: 10px; padding-right: 10px; width: 300px; height: 280px; } When i am setting this dimensions for the height, it works perfectly in chrome and internet explorer, but in firefox it takes different dimensions. the text goes under the next image in firefox. php code: <ul class="aboutlist1"> <li> <img class="aboutimg" src="images1.jpg" alt="<? $lang->text('ABOUT1'); ?>"/> <h1><? $lang->text('ABOUT1'); ?></h1> <p class="abouttext"><? $lang->text('ABOUT_TEXT1'); ?></p> </li> <li> <img class="aboutimg" src="images2.jpg" alt="<? $lang->text('ABOUT2'); ?>"/> <h1><? $lang->text('ABOUT2'); ?></h1> <p class="abouttext"><? $lang->text('ABOUT_TEXT2'); ?></p> </li> </ul> <ul class="aboutlist"> <li> <img class="aboutimg" src="image3.jpg" alt="<? $lang->text('ABOUT3'); ?>"/> <h1><? $lang->text('ABOUT3'); ?></h1> <p class="abouttext"><? $lang->text('ABOUT_TEXT3'); ?></p> </li> <li> <img class="aboutimg" src="image4.jpg" alt="<? $lang->text('ABOUT4'); ?>"/> <h1><? $lang->text('ABOUT4'); ?></h1> <p class="abouttext"><? $lang->text('ABOUT_TEXT4'); ?></p> </li> </ul>

    Read the article

  • Get part of array string

    - by user1560295
    Hello my output PHP code is : Array ( [country] => BG - Bulgaria ) ... and he comes from here : <?php $ip = $_SERVER['REMOTE_ADDR']; print_r(geoCheckIP($ip)); //Array ( [domain] => dslb-094-219-040-096.pools.arcor-ip.net [country] => DE - Germany [state] => Hessen [town] => Erzhausen ) //Get an array with geoip-infodata function geoCheckIP($ip) { //check, if the provided ip is valid if(!filter_var($ip, FILTER_VALIDATE_IP)) { throw new InvalidArgumentException("IP is not valid"); } //contact ip-server $response=@file_get_contents('http://www.netip.de/search?query='.$ip); if (empty($response)) { throw new InvalidArgumentException("Error contacting Geo-IP-Server"); } //Array containing all regex-patterns necessary to extract ip-geoinfo from page $patterns=array(); $patterns["country"] = '#Country: (.*?)&nbsp;#i'; //Array where results will be stored $ipInfo=array(); //check response from ipserver for above patterns foreach ($patterns as $key => $pattern) { //store the result in array $ipInfo[$key] = preg_match($pattern,$response,$value) && !empty($value[1]) ? $value[1] : ''; } return $ipInfo; } ?> How can I get ONLY the name of the Country like in my case "Bulgaria"? I think it will happen with preg_replace or substr but i dont know what is the better solution now.

    Read the article

  • Split screen in iPad

    - by AAT
    I working on a iPAD only app which requires me to split the screen such a way that: (1) there are 2 parts on the screen divided vertically (2) On the left side, user can communicate using a chat (3) On the right side, user can see continuous streaming data I am not sure (A) how can I do two tasks simultaneously (B)how to split the screen (is Split view the way to achieve both of these?) Thank you.

    Read the article

  • Checking if an SSH tunnel is up and running

    - by Jarmund
    I have a perl script which, when destilled a bit, looks like this: my $randport = int(10000 + rand(1000)); # Random port as other scripts like this run at the same time my $localip = '192.168.100.' . ($port - 4000); # Don't ask... backwards compatibility system("ssh -NL $randport:$localip:23 root\@$ip -o ConnectTimeout=60 -i somekey &"); # create the tunnel in the background sleep 10; # Give the tunnel some time to come up # Create the telnet object my $telnet = new Net::Telnet( Timeout => 10, Host => 'localhost', Port => $randport, Telnetmode => 0, Errmode => \&fail, ); # SNIPPED... a bunch of parsing data from $telnet The thing is that the target $ip is on a link with very unpredictable bandwidth, so the tunnel might come up right away, it might take a while, it might not come up at all. So a sleep is necessary to give the tunnel some time to get up and running. So the question is: How can i test if the tunnel is up and running? 10 seconds is a really undesirable delay if the tunnel comes up straight away. Ideally, i would like to check if it's up and continue with creating the telnet object once it is, to a maximum of, say, 30 seconds.

    Read the article

  • HTML 5 Canvas - Dynamically include multiple images in canvas

    - by Ron
    I need to include multiple images in a canvas. I want to load them dynamically via a for-loop. I tried a lot but in the best case only the last image is displayed. I check this tread but I still get only the last image. For explanation, here's my latest code(basically the one from the other post): for (var i = 0; i <= max; i++) { thisWidth = 250; thisHeight = 0; imgSrc = "photo_"+i+".jpg"; letterImg = new Image(); letterImg.onload = function() { context.drawImage(letterImg,thisWidth*i,thisHeight); } letterImg.src = imgSrc; } Any ideas?

    Read the article

  • How to inject AutoMapper IMappingEngine with StructureMap

    - by Jay Walker
    Most of the examples I've found for Automapper use the static Mapper object for managing type mappings. For my project, I need to inject an IMapperEngine as part of object construction using StructureMap so that we can mock the mapper in unit tests so we can't use the static mapper. I also need to support configuring AutoMapper Profiles. My question is how can I configure the StructureMap registry so that it can supply an instance of IMappingEngine when an instance of MyService is constructed. Here is the Service constructor signature: public MyService(IMappingEngine mapper, IMyRepository myRepository, ILogger logger) And here is the StructureMap Registry public class MyRegistry : StructureMap.Configuration.DSL.Registry { public MyRegistry() { For<IMyRepository>().Use<MyRepository>(); For<ILogger>().Use<Logger>(); //what to do for IMappingEngine? } } And the profile I want to load public class MyAutoMapperProfile : AutoMapper.Profile { protected override void Configure() { this.CreateMap<MyModel, MyDTO>(); } }

    Read the article

  • Is there a way to construct HTML/CSS in an HTML email such that if image X does not load, text Y will appear?

    - by wide_eyed_pupil
    I'm looking for something a little more sophisticated than the alt="Newsletter Heading text" attribute of <img> tag. So if the Masthead.png image doesn't load for whatever reason, I want the display text, say Font: 60px Helvetica Neue Black, Helvetica, ..., Sans Serif text-align: center to appear in the middle of the table cell that is my masthead instead of just the alt text in some small default font in top right corner. One idea I had was to use to put the image on-top of the text display but I don't know if z-depth is something I can use in email HTML(?4)?

    Read the article

  • removing the single quote from a list of

    - by tanky
    I need to append/format a url with a list of ids for an api call however, when i put the list at the end of the api https://api.twitter.com/1.1/users/lookup.json?user_id=%s'%a i just get an empty string as a response. i have tried turning the list into a string and removing the square brackets doing a = str(followers['ids'])[1:-1] but i still get the same problem. and im assuming that its being caused by the single quote at the start. i have tried removing the apostrophe from the string doing a.replace("'", "") and now i have run out of ideas thanks

    Read the article

  • HTML/CSS - Image inside a li element from the navigation bar

    - by musicvicious
    I have a navigation bar, and underneath a black div on which the drop-down elements from the navigation bar drops. This is not the main function of the black div. It is just for design, but it works really well. You can see here what i am talking about: http://www.ecoloc.ro/interior/test/regeneration . Now, what i want to do is that every time a main element from the navigation bar is hovered, an image big enough to cover the main element and a part of that black div beneath it will appear. You can see in the link that i posted, on that black gap i want the image. Can this be done? Thank you!

    Read the article

  • How to store visited states in iterative deepening / depth limited search?

    - by colinfang
    Update: Search for the first solution. for a normal Depth First Search it is simple, just use a hashset bool DFS (currentState) = { if (myHashSet.Contains(currentState)) { return; } else { myHashSet.Add(currentState); } if (IsSolution(currentState) return true; else { for (var nextState in GetNextStates(currentState)) if (DFS(nextState)) return true; } return false; } However, when it becomes depth limited, i cannot simply do this bool DFS (currentState, maxDepth) = { if (maxDepth = 0) return false; if (myHashSet.Contains(currentState)) { return; } else { myHashSet.Add(currentState); } if (IsSolution(currentState) return true; else { for (var nextState in GetNextStates(currentState)) if (DFS(nextState, maxDepth - 1)) return true; } return false; } Because then it is not going to do a complete search (in a sense of always be able to find a solution if there is any) before maxdepth How should I fix it? Would it add more space complexity to the algorithm? Or it just doesn't require to memoize the state at all. Update: for example, a decision tree is the following: A - B - C - D - E - A | F - G (Goal) Starting from state A. and G is a goal state. Clearly there is a solution under depth 3. However, using my implementation under depth 4, if the direction of search happens to be A(0) -> B(1) -> C(2) -> D(3) -> E(4) -> F(5) exceeds depth, then it would do back track to A, however E is visited, it would ignore the check direction A - E - F - G

    Read the article

  • Excel VBA Macro for Pivot Table with Dynamic Data Range

    - by John Ziebro
    CODE IS WORKING! THANKS FOR THE HELP! I am attempting to create a dynamic pivot table that will work on data that varies in the number of rows. Currently, I have 28,300 rows, but this may change daily. Example of data format as follows: Case Number Branch Driver 1342 NYC Bob 4532 PHL Jim 7391 CIN John 8251 SAN John 7211 SAN Mary 9121 CLE John 7424 CIN John Example of finished table: Driver NYC PHL CIN SAN CLE Bob 1 0 0 0 0 Jim 0 1 0 0 0 John 0 0 2 1 1 Mary 0 0 0 1 0 Code as follows: Sub CreateSummaryReportUsingPivot() ' Use a Pivot Table to create a static summary report ' with model going down the rows and regions across Dim WSD As Worksheet Dim PTCache As PivotCache Dim PT As PivotTable Dim PRange As Range Dim FinalRow As Long Dim FinalCol As Long Set WSD = Worksheets("PivotTable") 'Name active worksheet as "PivotTable" ActiveSheet.Name = "PivotTable" ' Delete any prior pivot tables For Each PT In WSD.PivotTables PT.TableRange2.Clear Next PT ' Define input area and set up a Pivot Cache FinalRow = WSD.Cells(Application.Rows.Count, 1).End(xlUp).Row FinalCol = WSD.Cells(1, Application.Columns.Count). _ End(xlToLeft).Column Set PRange = WSD.Cells(1, 1).Resize(FinalRow, FinalCol) Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:= _ xlDatabase, SourceData:=PRange) ' Create the Pivot Table from the Pivot Cache Set PT = PTCache.CreatePivotTable(TableDestination:=WSD. _ Cells(2, FinalCol + 2), TableName:="PivotTable1") ' Turn off updating while building the table PT.ManualUpdate = True ' Set up the row fields PT.AddFields RowFields:="Driver", ColumnFields:="Branch" ' Set up the data fields With PT.PivotFields("Case Number") .Orientation = xlDataField .Function = xlCount .Position = 1 End With With PT .ColumnGrand = False .RowGrand = False .NullString = "0" End With ' Calc the pivot table PT.ManualUpdate = False PT.ManualUpdate = True End Sub

    Read the article

  • iOS 6 Rotation issue - No rotation from Presented Modal View Controller

    - by hart1994
    I have a MainViewController which has a button which pushes a new view (InfoViewController), via flip horizontailly. like so: controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:controller animated:YES]; The MainView Controller supports Portrait and PortraitUpsideDown. Like so: - (BOOL)shouldAutorotate { return YES; } - (NSUInteger)supportedInterfaceOrientations { return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown); } In my InfoViewController it also states the above code. In my AppDelegate it has this in the LaunchOptions: [self.window setRootViewController:self.mainViewController]; In my app.plist file it supports all orientations. This is because other views need to support landscape as well. So On my MainViewController and InfoViewController I need only Portrait and PortraitUpsideDown. But on another view I need all orintations. My MainViewController works fine, but my InfoViewController is working for all orientations. I am having extreme diffulty trying to get this to work in iOS6. I have researched other posts and tried the assistance other people have provided, but had no luck whatsoever. Please can someone help me acheive this thank you. And I'm a Objective-C newbie :p

    Read the article

  • Parse string to create a list of element

    - by Nick
    I have a string like this: "\r color=\"red\" name=\"Jon\" \t\n depth=\"8.26\" " And I want to parse this string and create a std::list of this object: class data { std::string name; std::string value; }; Where for example: name = color value = red What is the fastest way? I can use boost. EDIT: This is what i've tried: vector<string> tokens; split(tokens, str, is_any_of(" \t\f\v\n\r")); if(tokens.size() > 1) { list<data> attr; for_each(tokens.begin(), tokens.end(), [&attr](const string& token) { if(token.empty() || !contains(token, "=")) return; vector<string> tokens; split(tokens, token, is_any_of("=")); erase_all(tokens[1], "\""); attr.push_back(data(tokens[0], tokens[1])); } ); } But it does not work if there are spaces inside " ": like color="red 1".

    Read the article

  • How to calculate the time difference between two time fields , with respect to the date changes

    - by Tiru
    I want to calculate the time difference.I have three EditTexts , I want to input the times in the first two edittexts in HH:MM format. And then calculate the time difference and the result will show on third edittext field in same format. If the date changes, the time difference will calculate according that, i.e If first time = 23:00 and second time = 01:00 then, the time difference = 02:00 hours public class TimeCalculate extends Activity { private String mBlock; private String mBlockoff; private String mBlockon ; // String mHours, mMinutes; Date date1, date2; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); EditText blockoff = (EditText) findViewById(R.id.blockoff); mBlockoff = blockoff.getText().toString(); EditText blockon = (EditText) findViewById(R.id.blockon); mBlockon = blockon.getText().toString(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("hh:mm"); try { date1 = simpleDateFormat.parse(mBlockoff); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { date2 = simpleDateFormat.parse(mBlockon); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } mBlock = getDifference(date1, date2); EditText block = (EditText) findViewById(R.id.block); block.setText(mBlock.toString()); } public static String getDifference(Date startTime, Date endTime) { if (startTime == null) return "corrupted"; Calendar startDateTime = Calendar.getInstance(); startDateTime.setTime(startTime); Calendar endDateTime = Calendar.getInstance(); endDateTime.setTime(endTime); long milliseconds1 = startDateTime.getTimeInMillis(); long milliseconds2 = endDateTime.getTimeInMillis(); long diff = milliseconds2 - milliseconds1; /*int hours = (int)diff / (60 * 60 * 1000); int minutes = (int) (diff / (60 * 1000)); minutes = minutes - 60 * hours; long seconds = diff / (1000); */ //timeDiff = DateUtils.formatElapsedTime(seconds); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:MM"); Date date = new Date(diff); return simpleDateFormat.format(date); } } I executed this code ,but gives error as Source not found.I think error at getDifference method.Please give any other logic

    Read the article

  • java.io.FileNotFoundException (Permission denied) When trying to write to the Android sdcard

    - by joefischer1
    I am trying to select an image file from the photo gallery and write to the sdcard. Below is the code that results in an exception. It appears to throw this exception when trying to create the FileOutputStream. I have the following line added to the manifest file nested inside the application element. I can't find a solution to the problem: <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> public boolean saveSelectedImage( Uri selectedImage, int imageGroup, int imageNumber ) { boolean exception = false; InputStream input = null; OutputStream output = null; if( externalStorageIsWritable() ) { try { ContentResolver content = ctx.getContentResolver(); input = content.openInputStream( selectedImage ); if(input != null) Log.v( CLASS_NAME, "Input Stream Opened successfully"); File outFile = null; File root = Environment.getExternalStorageDirectory( ); if(root == null) Log.v(CLASS_NAME, "FAILED TO RETRIEVE DIRECTORY"); else Log.v(CLASS_NAME, "ROOT DIRECTORY is:"+root.toString()); output = new FileOutputStream( root+"/Image"+ imageGroup + "_" + imageNumber + ".png" ); if(output != null) Log.e( CLASS_NAME, "Output Stream Opened successfully"); // output = new FileOutputStream // ("/sdcard/Image"+imageGroup+"_"+imageNumber+".png"); byte[] buffer = new byte[1000]; int bytesRead = 0; while ( ( bytesRead = input.read( buffer, 0, buffer.length ) ) >= 0 ) { output.write( buffer, 0, buffer.length ); } } catch ( Exception e ) { Log.e( CLASS_NAME, "Exception occurred while moving image: "); e.printStackTrace(); exception = true; } finally { // if(input != null)input.close(); // if(output != null)output.close(); // if (exception ) return false; } return true; } else return false; }

    Read the article

  • Reporting Services "cannot connect to the report server database"

    - by Dano
    We have Reporting Services running, and twice in the past 6 months it has been down for 1-3 days, and suddenly it will start working again. The errors range from not being able to view the tree root in a browser, down to being able to insert parameters on a report, but crashing before the report can generate. Looking at the logs, there is 1 error and 1 warning which seem to correspond somewhat. ERROR:Event Type: Error Event Source: Report Server (SQL2K5) Event Category: Management Event ID: 107 Date: 2/13/2009 Time: 11:17:19 AM User: N/A Computer: ******** Description: Report Server (SQL2K5) cannot connect to the report server database. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. WARNING: always comes before the previous error Event code: 3005 Event message: An unhandled exception has occurred. Event time: 2/13/2009 11:06:48 AM Event time (UTC): 2/13/2009 5:06:48 PM Event ID: 2efdff9e05b14f4fb8dda5ebf16d6772 Event sequence: 550 Event occurrence: 5 Event detail code: 0 Process information: Process ID: 5368 Process name: w3wp.exe Account name: NT AUTHORITY\NETWORK SERVICE Exception information: Exception type: ReportServerException Exception message: For more information about this error navigate to the report server on the local server machine, or enable remote errors. During the downtime we tried restarting everything from the server RS runs on, to the database it calls to fill reports with no success. When I came in monday morning it was working again. Anyone out there have any ideas on what could be causing these issues? Edit Tried both suggestions below several months ago to no avail. This issue hasn't arisen since, maybe something out of my control has changed....

    Read the article

  • WordPress and Debian VPS. Download Plugins from Dashboard: What Are FTP Credentials

    - by jw60660
    I'm pretty much a newbie when it comes to a VPS. I successfully installed a WordPress NGINX setup but I am lost when it comes to downloading plugins from the WordPress dashboard. What credentials do I use? I am still using root on the VPS, although I have disabled root login and am using value key pairs to login. do I have to change to another user from root or can I use root as the ftp credentials from the dashboard to download plugins? Thanks.

    Read the article

  • Two threads in a rails initializer file seems to not run them properly

    - by Luccas
    Initially I was using one thread to listen a queue from amazon and works perfectly. aws.rb Thread.new do queue1 = AWS::SQS::Queue.new(SQSADDR['my_queue']) queue1.poll do |msg| ... but now I appended another thread to listen another queue: ... Thread.new do queue2 = AWS::SQS::Queue.new(SQSADDR['my_another_queue']) queue2.poll do |msg| ... and now it seems to not work. Only the last one receives response... I have to join the threads? I can't understand What is going on?

    Read the article

  • TFS2010 Hangs “Waiting for Build Agent”

    - by Qpirate
    I have asked this question over on SO the link to the question is here but i am hoping this is a better place to ask it. I have 3 VM's each running the TFS Build Host Service 1 has 1 controller and 1 agent 2 have 2 Build Agents each. Most of the time (7\10 builds) it comes back with the following error message TF215097: An error occurred while initializing a build for build definition BUILD_DEFINITION: There was no endpoint listening at http://MACHINE1:9191/Build/v3.0/Services/Controller/14 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. and there is no errors when i do get this message. the following is the config file that i have created <configuration> <appSettings> <add key="traceWriter" value="true"/> </appSettings> <system.diagnostics> <switches> <add name="BuildServiceTraceLevel" value="4"/> <add name="API" value="4"/> <add name="Authentication" value="4"/> <add name="Authorization" value="4"/> <add name="Database" value="4"/> <add name="General" value="4"/> <add name="traceLevel" value="4"/> </switches> <trace autoflush="true" indentsize="4"> <listeners> <add name="myListener" type="Microsoft.TeamFoundation.TeamFoundationTextWriterTraceListener,Microsoft.TeamFoundation.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" initializeData="c:\logs\TFSBuildServiceHost.exe.log" /> <remove name="Default" /> </listeners> </trace> </system.diagnostics> </configuration> I do have my own custom activities in my build process but this does not seem to be a problem as sometimes the build actually does go. I have tried refreshing the template as some sites suggest. Has anyone come across a solution for this problem? or can anyone tell me how to catch these errors when they happen?

    Read the article

  • Open Windows Server 2012/Windows 8 Start Menu

    - by bmccleary
    I realize that Windows Server 2012 (and Windows 8) removed the start menu button and replaced it with moving your mouse to the upper right corner of the screen. This works fine when the desktop is full screen. However, I access all my servers through windowed RDP connections (or through the Hyper-V console window) and in this case, the desktop is not full screen. Therefore, in order to open the new "start" menu, I have to slowly move my mouse very carefully within the window to just a few pixels within top right corner of the window in order to open the menu. Also, because the session is windowed, the default hot keys (Windows + D, etc.) won't work. There has got to be an easier way. Has anyone else experienced this frustration?

    Read the article

  • Windows 7 keep internet connection after IPSec established

    - by mmc18
    How I can keep internet connection after establishing IpSec connection to server? I have followed to following link to establihed IpSec server http://rootmanager.com/ubuntu-ipsec-l2tp-windows-domain-auth/setting-up-openswan-xl2tpd-with-native-windows-clients.html then following the below one to connect this server from Windows 7 machine. http://confoundedtech.blogspot.com/2012/07/windows-l2tp-ipsec-vpn-connection-to.html I am able to connect and properly sending data. But after establihing IpSec conenction, my internet conenction is dropped. How I can keep both connection alive?

    Read the article

  • Security implications of adding www-data to /etc/sudoers to run php-cgi as a different user

    - by BMiner
    What I really want to do is allow the 'www-data' user to have the ability to launch php-cgi as another user. I just want to make sure that I fully understand the security implications. The server should support a shared hosting environment where various (possibly untrusted) users have chroot'ed FTP access to the server to store their HTML and PHP files. Then, since PHP scripts can be malicious and read/write others' files, I'd like to ensure that each users' PHP scripts run with the same user permissions for that user (instead of running as www-data). Long story short, I have added the following line to my /etc/sudoers file, and I wanted to run it past the community as a sanity check: www-data ALL = (%www-data) NOPASSWD: /usr/bin/php-cgi This line should only allow www-data to run a command like this (without a password prompt): sudo -u some_user /usr/bin/php-cgi ...where some_user is a user in the group www-data. What are the security implications of this? This should then allow me to modify my Lighttpd configuration like this: fastcgi.server += ( ".php" => (( "bin-path" => "sudo -u some_user /usr/bin/php-cgi", "socket" => "/tmp/php.socket", "max-procs" => 1, "bin-environment" => ( "PHP_FCGI_CHILDREN" => "4", "PHP_FCGI_MAX_REQUESTS" => "10000" ), "bin-copy-environment" => ( "PATH", "SHELL", "USER" ), "broken-scriptfilename" => "enable" )) ) ...allowing me to spawn new FastCGI server instances for each user.

    Read the article

  • Java login through LDAP

    - by Salda
    I am starting to write an application for our office and the first step is authentication through LDAP where all users already exist. Everything I need is a code in Java to check if the pair <nick,password> is right. Google found me many links, but I think that I will find here the most sofisticate, short and up to date solution (I don't want to read all articles like 2 whole days to do something so simple). I have written many dkBs of code in C++, but in Java I am total noob and I haven't coded anything with LDAP yet so try to be simple if speaking in Java and LDAP terms if possible.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >