Daily Archives

Articles indexed Thursday December 13 2012

Page 12/16 | < Previous Page | 8 9 10 11 12 13 14 15 16  | Next Page >

  • Simple css class selector issue

    - by FlyingCat
    I am having a problem with a simple first of type css issue I have <div class='test'> <div>test 1</div> <div>test 2</div> </div> <div class='test'> <div>test 3</div> <div>test 4</div> </div> <div class='test'> <div>test 5</div> <div>test 6</div> </div> I want the first test div showing background red and the rest are blue. I have .test{ background-color: blue; margin: 15px; border-top: dashed 1px grey; } .test:first-of-type{ background-color: red; border-top:0; } but all my divs are showing blue. Am I doing something wrong here? Thanks for the help!

    Read the article

  • Advanced LINQ Update Statement

    - by user1902490
    I have a data base with Price_old like: Date --- Hour --- Price _____________________________ Jan 1 --- 1 --- $3.0 Jan 1 --- 2 --- $3.1 Jan 1 --- 3 --- $3.3 Jan 1 --- 4 --- $3.15 Jan 2 --- 1 --- $2.95 Jan 2 --- 2 --- $3.2 Jan 2 --- 3 --- $3.05 What I then have is a spreadsheet, with the same structure, that I will be reading into a datatable, I'll call the new datatable Price_New, note that price new may not have all the same date/hours as Price_Old So, I end up with 2 datatables, Price_Old, and Price_New, and what I need to do is update Price_old with the new prices in Price_New, and then commit those new prices to the Database. I am kinda new to LINQ (about 30 mins of experience) and would really appreciate if someone could give me a pointer or two on whether or not this is doing in LINQ and what the best method would be. Thanks

    Read the article

  • Dynamically Changing an img tag's onemouseover attribute with Javascript nulls it instead

    - by ?s?zs?
    I want to create an img that has four different states: State 1 over State 1 out State 2 over State 2 out Each state is a different image, and the user can toggle between states 1 and 2 by clicking on the image. To do this I change the src when the image is clicked and the onmouseover and onmouseout attributes of the img element. However when the attributes have been changed they become nulled and do nothing. How can I dynamically change these properties? Here is the code I am using: <!DOCTYPE html> <html> <head> <script> function change() { document.getElementById('image').src="http://youtube.thegoblin.net/layoutFix/hideplaylist.png"; document.getElementById('image').onmouseover="this.src='http://youtube.thegoblin.net/layoutFix/hideplaylistDark.png'"; document.getElementById('image').onmouseout="this.src='http://youtube.thegoblin.net/layoutFix/hideplaylist.png'"; } </script> </head> <body> <img id="image" src="http://youtube.thegoblin.net/layoutFix/showplaylist.png" onmouseover="this.src='http://youtube.thegoblin.net/layoutFix/showplaylistDark.png'" onmouseout="this.src='http://youtube.thegoblin.net/layoutFix/showplaylist.png'" onClick="change()"> </body> </html>

    Read the article

  • Replacing a unicode character in UTF-8 file using delphi 2010

    - by Jake Snake
    I am trying to replace character (decimal value 197) in a UTF-8 file with character (decimal value 65) I can load the file and put it in a string (may not need to do that though) SS := TStringStream.Create(ParamStr1, TEncoding.UTF8); SS.LoadFromFile(ParamStr1); //S:= SS.DataString; //ShowMessage(S); However, how do i replace all 197's with a 65, and save it back out as UTF-8? SS.SaveToFile(ParamStr2); SS.Free; -------------- EDIT ---------------- reader:= TStreamReader.Create(ParamStr1, TEncoding.UTF8); writer:= TStreamWriter.Create(ParamStr2, False, TEncoding.UTF8); while not Reader.EndOfStream do begin S:= reader.ReadLine; for I:= 1 to Length(S) do begin if Ord(S[I]) = 350 then begin Delete(S,I,1); Insert('A',S,I); end; end; writer.Write(S + #13#10); end; writer.Free; reader.Free;

    Read the article

  • ASP.NET Web API crash MSVCR90.dll

    - by user858931
    I have a web api app developed on VS2010. The application calls an external program to run and it runs just fine if I execute in VS2010. But then when I deploy the web api to IIS 7 and 7.5, in some cases, it crashes. Below is the details I got from Event Viewer/Appliation: Fault bucket , type 0 Event Name: BEX Response: Not available Cab Id: 0 Problem signature: P1: TestProgram.exe P2: 1.0.4728.17141 P3: 50c76dea P4: MSVCR90.dll P5: 9.0.30729.6161 P6: 4dace5b9 P7: 0003024a P8: c0000417 P9: 00000000 P10: Attached files: These files may be available here: C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_InferenceGenerat_95abb43ace91480da6b8f27f9937db667bc58f_7bb1549d Analysis symbol: Rechecking for solution: 0 Report Id: da8f304e-44c0-11e2-b4e8-0026b97a5242 Report Status: 0 Any idea why it happens and how to fix it? Thanks.

    Read the article

  • android camera preview blank screen

    - by user1104836
    I want to capture a photo manually not by using existing camera apps. So i made this Activity: public class CameraActivity extends Activity { private Camera mCamera; private Preview mPreview; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_camera); // Create an instance of Camera // mCamera = Camera.open(0); // Create our Preview view and set it as the content of our activity. mPreview = new Preview(this); mPreview.safeCameraOpen(0); FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview); preview.addView(mPreview); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_camera, menu); return true; } } This is the CameraPreview which i want to use: public class Preview extends ViewGroup implements SurfaceHolder.Callback { SurfaceView mSurfaceView; SurfaceHolder mHolder; //CAM INSTANCE ================================ private Camera mCamera; List<Size> mSupportedPreviewSizes; //============================================= /** * @param context */ public Preview(Context context) { super(context); mSurfaceView = new SurfaceView(context); addView(mSurfaceView); // Install a SurfaceHolder.Callback so we get notified when the // underlying surface is created and destroyed. mHolder = mSurfaceView.getHolder(); mHolder.addCallback(this); mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } /** * @param context * @param attrs */ public Preview(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub } /** * @param context * @param attrs * @param defStyle */ public Preview(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // TODO Auto-generated constructor stub } /* (non-Javadoc) * @see android.view.ViewGroup#onLayout(boolean, int, int, int, int) */ @Override protected void onLayout(boolean arg0, int arg1, int arg2, int arg3, int arg4) { // TODO Auto-generated method stub } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { // Now that the size is known, set up the camera parameters and begin // the preview. Camera.Parameters parameters = mCamera.getParameters(); parameters.setPreviewSize(width, height); requestLayout(); mCamera.setParameters(parameters); /* Important: Call startPreview() to start updating the preview surface. Preview must be started before you can take a picture. */ mCamera.startPreview(); } @Override public void surfaceCreated(SurfaceHolder holder) { // TODO Auto-generated method stub } @Override public void surfaceDestroyed(SurfaceHolder holder) { // Surface will be destroyed when we return, so stop the preview. if (mCamera != null) { /* Call stopPreview() to stop updating the preview surface. */ mCamera.stopPreview(); } } /** * When this function returns, mCamera will be null. */ private void stopPreviewAndFreeCamera() { if (mCamera != null) { /* Call stopPreview() to stop updating the preview surface. */ mCamera.stopPreview(); /* Important: Call release() to release the camera for use by other applications. Applications should release the camera immediately in onPause() (and re-open() it in onResume()). */ mCamera.release(); mCamera = null; } } public void setCamera(Camera camera) { if (mCamera == camera) { return; } stopPreviewAndFreeCamera(); mCamera = camera; if (mCamera != null) { List<Size> localSizes = mCamera.getParameters().getSupportedPreviewSizes(); mSupportedPreviewSizes = localSizes; requestLayout(); try { mCamera.setPreviewDisplay(mHolder); } catch (IOException e) { e.printStackTrace(); } /* Important: Call startPreview() to start updating the preview surface. Preview must be started before you can take a picture. */ mCamera.startPreview(); } } public boolean safeCameraOpen(int id) { boolean qOpened = false; try { releaseCameraAndPreview(); mCamera = Camera.open(id); mCamera.startPreview(); qOpened = (mCamera != null); } catch (Exception e) { // Log.e(R.string.app_name, "failed to open Camera"); e.printStackTrace(); } return qOpened; } Camera.PictureCallback mPicCallback = new Camera.PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { // TODO Auto-generated method stub Log.d("lala", "pic is taken"); } }; public void takePic() { mCamera.startPreview(); // mCamera.takePicture(null, mPicCallback, mPicCallback); } private void releaseCameraAndPreview() { this.setCamera(null); if (mCamera != null) { mCamera.release(); mCamera = null; } } } This is the Layout of CameraActivity: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".CameraActivity" > <FrameLayout android:id="@+id/camera_preview" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" /> <Button android:id="@+id/button_capture" android:text="Capture" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /> </LinearLayout> But when i start the CameraActivity, i just see a blank white background and the Capture-Button??? Why i dont see the Camera-Screen?

    Read the article

  • mod_rewrite to redirect URL with query string

    - by meeble
    I've searched all over stackoverflow, but none of the answers seem to be working for this situation. I have a lot of working mod_rewrite rules already in my httpd.conf file. I just recently found that Google had indexed one of my non-rewritten URLs with a query string in it: http://domain.com/?state=arizona I would like to use mod_rewrite to do a 301 redirect to this URL: http://domain.com/arizona The issue is that later on in my rewrite rules, that 2nd URL is being rewritten to pass query variables on to WordPress. It ends up getting rewritten to: http://domain.com/index.php?state=arizona Which is the proper functionality. Everything I have tried so far has either not worked at all or put me in an endless rewrite loop. This is what I have right now, which is getting stuck in a loop: RewriteCond %{QUERY_STRING} state=arizona [NC] RewriteRule .* http://domain.com/arizona [R=301,L] #older rewrite rule that passes query string based on URL: RewriteRule ^([A-Za-z-]+)$ index.php?state=$1 [L] which gives me an endless rewrite loop and takes me to this URL: http://domain.com/arizona?state=arizona I then tried this: RewriteRule .* http://domain.com/arizona? [R=301,L] which got rid of the query string in the URL, but still creates a loop.

    Read the article

  • Setting up padding for websites in mobile devices

    - by ambrelasweb
    I had finished this website a while ago but something happened to it and I've now spent all day fixing it and getting it back from scratch as my backup wasn't correctly done. I don't quite understand what it's doing as I've done this technique on many other websites with no troubles, maybe I've looked at this website too long? Here is the website. I'm wanting to put some space on the left and right hand side, however I dont just have one container as I was needing the dark grey bar at 100% of the screen and always under the banner no matter where it was. So there are 4 "containing" divs that I want to have the space. I've placed soem CSS3 media queries in but now I'm getting a gap to the right. I was thinking it was because my background mages are going all the way across but they set at 100% so I'm just not understanding whats going on. It's somethign simple, I'm not seeing it right now.. This is what I have for the media queries /* Smartphones (portrait and landscape) ----------- */ @media only screen and (min-device-width : 320px) and (max-device-width : 480px) { #header, #banner, #main, #footer-widget-area { padding: 0 2em 0 2em; } } This is what t looks like on my iPhone Any advice is helpful and appreciated.

    Read the article

  • How can I select an audio output device in directshow

    - by Vibhore Tanwer
    I was wondering how I can select the output device for audio in directshow. I am able to get available audio output devices in directshow. But how can I make one of these to be audio output device. Its always going for the default audio device. I want to be able to output audio on my choice of device. I have been struggling through google but couldn't find anything useful. All I could get was this link but it doesn't really solve my problem. Any help will be really helpful for me.

    Read the article

  • jquery buttons icons for dialog

    - by khinester
    I have this code: $(function() { var mainButtons = [ {text: "Invite" , 'class': 'invite-button' , click: function() { // get list of members alert('Invite was clicked...'); } } // end Invite button , {text: "Options" , 'class': 'options-button' , click: function() { alert('Options...'); } } // end Options button ] // end mainButtons , commentButtons = [ {text: "Clear" , 'class': 'clear-button' , click: function() { $('#comment').val('').focus().select(); } } // end Clear button , {text: "Post comment" , 'class': 'post-comment-button' , click: function() { alert('send comment...'); } } // end Post comment ] // end commentButtons $( "#form" ).dialog({ autoOpen: false , height: 465 , width: 700 , modal: true , position: ['center', 35] , buttons: mainButtons }); $( "#user-form" ) .button() .click(function() { $(this).effect("transfer",{ to: $("#form") }, 1500); $( "#form" ).dialog( "open" ); $( ".invite-button" ).button({ icons: {primary:'ui-icon-person',secondary:'ui-icon-triangle-1-s'} }); $( ".options-button" ).button({ icons: {primary:'ui-icon-gear'} }); }); // Add comment... $("#comment, .comment").click(function(){ $('#comment').focus().select(); $("#form").dialog({buttons: commentButtons}); $( ".post-comment-button" ).button({ icons: {primary:'ui-icon-comment'} }); $( ".clear-button" ).button({ icons: {primary:'ui-icon-refresh'} }); }); //Add comment // Bind back the Invite, Options buttons $(".files, .email, .event, .map").click(function(){ $("#form").dialog({buttons: mainButtons}); $( ".invite-button" ).button({ icons: {primary:'ui-icon-person',secondary:'ui-icon-triangle-1-s'} }); $( ".options-button" ).button({ icons: {primary:'ui-icon-gear'} }); }); // Tabs $( "#tabs" ).tabs(); $( ".tabs-bottom .ui-tabs-nav, .ui-tabs-nav > *" ) .removeClass( "ui-widget-header" ) .addClass( "ui-corner-bottom" ); }); ? What is the right way to add the button icons? As in my code I had to add it two times, once: $( "#user-form" ) .button() .click(function() { $(this).effect("transfer",{ to: $("#form") }, 1500); $( "#form" ).dialog( "open" ); ... and $(".files, .email, .event, .map").click(function(){ ... Could this code be improved further? I don't seem to be able to get the "transfer" effect to work correctly in a modal. I added: , close: function() { $(this).effect("transfer",{ to: $("#user-form") }, 1500); } to the $( "#form" ).dialog({ How would you go about in getting the "transfer" to work nicely when you open and close the dialog box?

    Read the article

  • Android - Start service on boot

    - by Gady
    From everything I've seen on Stack Exchange and elsewhere, I have everything set up correctly to start an IntentService when Android OS boots. Unfortunately it is not starting on boot, and I'm not getting any errors. Maybe the experts can help... Manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.phx.batterylogger" android:versionCode="1" android:versionName="1.0" android:installLocation="internalOnly"> <uses-sdk android:minSdkVersion="8" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.BATTERY_STATS" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <service android:name=".BatteryLogger"/> <receiver android:name=".StartupIntentReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> </application> </manifest> BroadcastReceiver for Startup: package com.phx.batterylogger; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class StartupIntentReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent serviceIntent = new Intent(context, BatteryLogger.class); context.startService(serviceIntent); } } UPDATE: I tried just about all of the suggestions below, and I added logging such as Log.v("BatteryLogger", "Got to onReceive, about to start service"); to the onReceive handler of the StartupIntentReceiver, and nothing is ever logged. So it isn't even making it to the BroadcastReceiver. I think I'm deploying the APK and testing correctly, just running Debug in Eclipse and the console says it successfully installs it to my Xoom tablet at \BatteryLogger\bin\BatteryLogger.apk. Then to test, I reboot the tablet and then look at the logs in DDMS and check the Running Services in the OS settings. Does this all sound correct, or am I missing something? Again, any help is much appreciated.

    Read the article

  • Determine wifi capabilities of Windows box (with WSUS install rules)

    - by Hagen von Eitzen
    I need to determine if a computer is in fact a laptop with wifi capabilities (with emphasis on wifi rather than laptop). More precisely, I want to distribute a piece of software I wrote via WSUS and Local Update Publisher to those clients. To this end, I want to create appropriate "Package installable rules", that is simple rule used bay the Windows Update Service on the client to decide beforehand whether or not an update/installation package is applicable. Typically, such "installabel rules" are logical combinations of rules of type "File exists", "Registry Key exists", "WMI Query", "MSI Product Installed", so I'd prefer one of those methods. The method I hope someone here can help me find should work with Win 7/Vista, preferably also with XP. My guess is that WMI query is the way to go, but I have little experience in that. I have found that one can e.g. query for EnclosureType and that might detect a laptop. However, I would be much happier if an actually available wifi interface would be detected. Does anyone have an idea how to approach this? If there is anything you need me to clarify, don't hesitate to comment.

    Read the article

  • postfix header_checks using regexp proper setup

    - by Philip Rhee
    I just can't seem to figure out why header_checks are not being evaluated. I'm on Ubuntu 12.04, postfix 2.7, dovecote, spamassasin, clamav, amavis. I add following line to /etc/postfix/main.cf : header_checks = regexp:/etc/postfix/header_checks And here is header_checks : /From: .*/ REPLACE From: [email protected] To test out regexp : #postmap -q "From: <werwe>" regexp:/etc/postfix/header_checks which evaluates correctly and give me return output of : REPLACE From: [email protected] However, when I try to send email from commandline or from php webpage, postfix will not replace the From header. I'm stumped.

    Read the article

  • Cisco Router 1921

    - by mytempfw
    I'm very new in networking and I'm trying to setup my network as follow [ISP Modem/Router/Switch] + --- + {fxp0} [Linux Firewall] {fxp1} + --- + {??} [Cisco Router 1921] {GE 0/0} + --- + [Cisco Switch] + ... Servers {GE 0/1} + --- + [Cisco Switch] + ... Servers My questions are, Since I'm using both GE 0/0 and GE 0/1 ports to connect to switch, how can I connect my Linux Firewall (Port fxp1) to my Cisco Router? I know the USB and Console port are for configuration, can I use AUX port to connect my firewall (if so is it consider a right way)? Is my setup is right? if not can someone please explain to me to do the setup in right way. Link to the picture of my router: Cisco Router 1921 Thanks

    Read the article

  • How does a Promise FastTrak 133 interleave a striped array?

    - by Jemenake
    I co-worker had two drives configured as a stripe on a motherboard with an on-board Promise FastTrak 133. The motherboard failed, and we've been unable to find any others with an on-board Promise controller which can recognize the array. With Linux or some disk editors, I can see data on both drives... and I want to see if I can combine the data from both drives onto a single, larger drive. But I need to know how that information is interleaved on the drives. I've tried dmraid on Linux, but that doesn't recognize the drives as an array. I guess I could just try combining alternating blocks from the drives, starting with a block size of 256B and keep doubling until I get a result that looks intact. But I'd like to avoid that if someone already knows how Promise controllers spread the data over a striped array.

    Read the article

  • Force logoff of idle users on Windows 7 workstation with fast user switching enabled

    - by newmanth
    We have mission-critical Windows 7 workstations on our network that must be available to any user at any time, even when it has been locked by a prior user. Thus, we have fast user switching enabled. Unfortunately, it's not unusual for us to have a dozen or more different users logged onto the same machine at the same time, with a corresponding degradation in service. We've done our best at educating the masses to log off at the end of their shift. But users being users, this does not happen on a consistent basis. Does anyone know of a clean way to force logoff idle users after a certain amount of time has elapsed? I am open to any method that could be deployed/configured via script, GPO, or SCCM.

    Read the article

  • Strange permission errors with Windows Server 2008

    - by Spirit
    I just don't know a better way to describe my issue that is driving me nuts. I am trying to establish a test domain with virtual machines on a box that has Win7 with VMwware workstation installed. The purpouse with this domain will be so that we can try and test different situations before they go into the production network. I build a VM with WinSrv2008R2 and I am using that VM as a template to make other servers for the domain by making clones of it. Now I raise a DC with one clone and a member server with another clone - I add the server to the domain. I am following a standard procedure as always (it is not my first domain). Then I make an admin account and I am adding the admin to be a member of the Domain and Enterprise Admins group. That admin is admin with full priviledges on the DC.. no problem there. But on the other server has ... somewhat half the privileges and I cant log in via RDP. I tryed with another account. Same issues. For example (with half the privileges): I can't open the Even Viewer if I go via Start - Administrative Tools - Event Viewer. But I can open the Even Viewer via the server manager. You can notice this on the image below. I mean WTF??? I am going crazy, I haven't experienced anything similar in my three years of expertise. I already lost 3 days troubleshooting this. Could this be related with the cloning? Perhaps if I make fresh installs of WinSrv2008 there won't be any problems? I've had raised test domains as VMs on other occasions before, and there weren't any problems then. This is VMware Workstation 8. I've made clones before, on Workstation 7 it didn't had any problems. Anyone has any ideas? UPDATE: This is the info from the event log when I try to access via RDP: An account failed to log on. Subject: Security ID: NULL SID Account Name: - Account Domain: - Logon ID: 0x0 Logon Type: 3 Account For Which Logon Failed: Security ID: NULL SID Account Name: pat.coleman Account Domain: lab Failure Information: Failure Reason: Domain sid inconsistent. Status: 0xc000006d Sub Status: 0xc000019b

    Read the article

  • Cisco Pix does not let traffic pass from outside to inside even though ACL permits

    - by Rickard
    I have tried to make my pix 515 allow traffic from outisde interface to inside, but despite permitting ACL's, it doesn't seem to let traffic through. (It is letting traffic out as it should though) I am have tried both of the following: access-list acl_in extended permit tcp any host 10.131.73.2 eq www and access-list acl_in extended permit ip any any None of them help, but I can access 10.131.73.2 from any host on the inside network. This is a one single host on the inside that should every now and then have an HTTP server running for development purpouses, so it doesn't need to reside on DMZ (and as far as I know, I can't place it on DMZ either as it's in the same subnet as the other ip's I have. Could I have missed anything? I am using PIX Version 8.0(4) My current running config looks like this: http://pastebin.com/TvRFyDrF Hope someone can help me get this working.

    Read the article

  • Converting a Windows 2003 server

    - by Jim Bass
    We have a legacy database system based upon MS SQL running on Windows Server 2003. The client software will only run on Windows XP. We have recently had success converting a client into a virtual machine and running it under Fusion on Mac minis. So far, it is working incredibly well. So well, in fact, that we are now considering trying to convert the server to a virtual machine. This raises several questions, though: 1. The server uses a raid array. Does the VM virtualize the raid array? I only ask because in my experience Windows products don't like it when you change core hardware. 2. Is there any reason why running SQL server on a virtual machine won't work? It will be up 24/7. 3. Is there a different converter for servers? 4. Will I have to track down the licensing for MS SQL and Server 2003 or will they come across ok? 5. The company that designed the software is no longer in business. There is some fear that the software is somehow tied to the hardware configuration. We bought the hardware, but their engineers came out and configured the system. Will the virtual machine be able to spoof particular chip sets? Thanks! Jim Bass

    Read the article

  • duplicate cache pages: Varnish

    - by Sukhjinder Singh
    Recently we have configured Varnish on our server, it was successfully setup but we noticed that if we open any page in multiple browsers, the Varnish send request to Apache not matter page is cached or not. If we refresh twice on each browser it creates duplicate copies of the same page. What exactly should happen: If any page is cached by Varnish, the subsequent request should be served from Varnish itself when we are opening the same page in browser OR we are opening that page from different IP address. Following is my default.vcl file backend default { .host = "127.0.0.1"; .port = "80"; } sub vcl_recv { if( req.url ~ "^/search/.*$") { }else { set req.url = regsub(req.url, "\?.*", ""); } if (req.restarts == 0) { if (req.http.x-forwarded-for) { set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip; } else { set req.http.X-Forwarded-For = client.ip; } } if (!req.backend.healthy) { unset req.http.Cookie; } set req.grace = 6h; if (req.url ~ "^/status\.php$" || req.url ~ "^/update\.php$" || req.url ~ "^/admin$" || req.url ~ "^/admin/.*$" || req.url ~ "^/flag/.*$" || req.url ~ "^.*/ajax/.*$" || req.url ~ "^.*/ahah/.*$") { return (pass); } if (req.url ~ "(?i)\.(pdf|asc|dat|txt|doc|xls|ppt|tgz|csv|png|gif|jpeg|jpg|ico|swf|css|js)(\?.*)?$") { unset req.http.Cookie; } if (req.http.Cookie) { set req.http.Cookie = ";" + req.http.Cookie; set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";"); set req.http.Cookie = regsuball(req.http.Cookie, ";(SESS[a-z0-9]+|SSESS[a-z0-9]+|NO_CACHE)=", "; \1="); set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", ""); set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", ""); if (req.http.Cookie == "") { unset req.http.Cookie; } else { return (pass); } } if (req.request != "GET" && req.request != "HEAD" && req.request != "PUT" && req.request != "POST" && req.request != "TRACE" && req.request != "OPTIONS" && req.request != "DELETE") {return(pipe);} /* Non-RFC2616 or CONNECT which is weird. */ if (req.request != "GET" && req.request != "HEAD") { return (pass); } if (req.http.Accept-Encoding) { if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") { # No point in compressing these remove req.http.Accept-Encoding; } else if (req.http.Accept-Encoding ~ "gzip") { set req.http.Accept-Encoding = "gzip"; } else if (req.http.Accept-Encoding ~ "deflate") { set req.http.Accept-Encoding = "deflate"; } else { # unknown algorithm remove req.http.Accept-Encoding; } } return (lookup); } sub vcl_deliver { if (obj.hits > 0) { set resp.http.X-Varnish-Cache = "HIT"; } else { set resp.http.X-Varnish-Cache = "MISS"; } } sub vcl_fetch { if (beresp.status == 404 || beresp.status == 301 || beresp.status == 500) { set beresp.ttl = 10m; } if (req.url ~ "(?i)\.(pdf|asc|dat|txt|doc|xls|ppt|tgz|csv|png|gif|jpeg|jpg|ico|swf|css|js)(\?.*)?$") { unset beresp.http.set-cookie; } set beresp.grace = 6h; } sub vcl_hash { hash_data(req.url); if (req.http.host) { hash_data(req.http.host); } else { hash_data(server.ip); } return (hash); } sub vcl_pipe { set req.http.connection = "close"; } sub vcl_hit { if (req.request == "PURGE") {ban_url(req.url); error 200 "Purged";} if (!obj.ttl > 0s) {return(pass);} } sub vcl_miss { if (req.request == "PURGE") {error 200 "Not in cache";} }

    Read the article

  • Is an average RAM usage per Apache process of 43 MB "normal" for a Social Networking site? [closed]

    - by Programmer
    I have a Social Networking site that runs on a single LAMP Server that handles everything. The average RAM usage per Apache process is 43 MB. Is that amount roughly within the expected range for a Social Networking site, or is it too high? If it's too high, where and how can I look to bring that average number down? (If you need more details to determine whether it's within the expected range or not, just let me know and I'll edit my question to provide them as best I can.)

    Read the article

  • Postfix: Modify sender address based on recipient

    - by PJ P
    We have a Postfix server that receives mail from our application servers. Senders are in the form [email protected] (where host.fqdn can vary, depending on source server) and recipients can be internal or external users. Messages going to external users should have the sender changed to [email protected]. I have tried using canonical maps, but since that is handled by the cleanup daemon, before any transport decisions are made, it would affect all sender addresses. I have also tried creating a custom smtp transport with generic mappings and configuring transport_maps to use that custom smtp transport for external domains. However, generic mappings affect both sender and recipient addresses. Lastly, I've tried the following: Create a custom smtpd daemon that specifies sender canonical maps and a unique transport table. Send all externally addressed mail to that custom daemon. Ideally, sender canonical maps would transform the sender address and the unique transport table would relay messages to the internet. However, evidently, only one transport table can be used per Postfix instance. I want to avoid creating an entirely new Postfix instance to accommodate this rewriting. Any suggestions? (and thanks in advance)

    Read the article

  • Amazon EC2 - how to determine how busy each CPU is

    - by sally
    I have an Amazon EC2 micro instance. I believe that this is 1 core (or 2 for periodic bursts) with 4 CPU's. I'm getting confused with the terminology (ECU vs CPU vs Core) but really I would like to see how busy each CPU is. When I look at top it seems to be showing me just the cores. I want to see if my process is be spread out across the available processors and how busy each is, what is the appropriate command to do this?

    Read the article

  • Puppet inventory service using puppetdb

    - by Oli
    I have 3 servers set up. A puppet master using passenger (puppet-server1), dashboard using passenger (puppet-server2) and puppetdb (puppet-server3). I cannot get the inventory service working in the dashboard. The puppet master is able to sign certs and hand out manifests. The nodes have checked in to the dashboard ok The puppetdb appears to be working - logs files as follows: 2012-12-13 17:53:10,899 INFO [command-proc-74] [puppetdb.command] [8490148f-865a-45c8-b5b5-2c8824d753dd] [replace facts] puppet-server3.test.net 2012-12-13 17:53:11,041 INFO [command-proc-74] [puppetdb.command] [dfcc5168-06df-41d4-9a97-77b4cd3f4a2b] [replace catalog] puppet-server3.test.net 2012-12-13 17:55:28,600 INFO [command-proc-74] [puppetdb.command] [b2cc0a96-0404-49f5-96ad-19c778508d3d] [replace facts] puppet-client2.test.net 2012-12-13 17:55:28,729 INFO [command-proc-74] [puppetdb.command] [4dc4b8f3-06df-4dad-a89a-92ac80447b99] [replace catalog] puppet-client2.test.net The puppet master has the following configured in puppet.conf [master] certname = puppet-server1.test.net storeconfigs = true storeconfigs_backend = puppetdb reports = store, http reporturl = http://puppet-server2.test.net/reports/upload The puppet master have the following configured in auth.conf #access for puppet dashboard facts path /facts auth yes method find, search allow dashboard The puppet dashboard has this configured in /usr/share/puppet-dashboard/config/settings.yml # Hostname of the inventory server. inventory_server: 'puppet-server3.test.net' # Port for the inventory server. inventory_port: 8081 The inventory is on as I see a link to the inventory in the dashboard server But I am getting this error: Inventory Could not retrieve facts from inventory service: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read finished A clearly an SSL error - but I have followed the documentation and have no idea how to fix this. Can anyone help please? Oli

    Read the article

  • Redhat cluster Vs Pacemaker Vs Gluster Vs Sheepdog

    - by chandank
    Changing the entire question as earlier one was very confusing. I have been exploring different clustering system to run Virtual machines on two different machines on LAN with high availability. Currently I am already using DRBD resource on two different machines on Primary/Secondary mode. In case the primary fails I manually promote the secondary to Primary and start the VM. I also explored Gluster and looks good, however, I would rather prefer clustering over Gluster (user space FS). So if anyone has idea which one would be better from ease of use prospective please I would be interested in. Moreover, sheepdog project appears good, however, could not find much documentations/Howtos. I am using Centos 6.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16  | Next Page >