Hi!
I should create a google chrome extension.It's a multimedia web recorder.
Should I parse http headers (http sniffer), between these take those videos and save.
not exist httpFox for Chrome, how could I do?
Thanks
I'm trying to modify the Connection header with the following code with no success
jQuery.ajax({
url: URL,
async: boolVariable,
beforeSend: function(xhr)
{
xhr.setRequestHeader("Connection", "close");
}
})
The request headers via Firebug show:
Connection keep-alive
X-Requested-With XMLHttpRequest
Any odd bugs/problems with setting this particular header known? Or is there something I'm doing wrong?
I use HttpURLConnection to do HTTP POST but I dont always get back the full response. I wanted to debug the problem, but when I step through each line it worked. I thought it must be a timing issue so I added Thread.sleep and it really made my code work, but this is only a temporary workaround. I wonder why is this happening and how to solve. Here is my code:
URL u = new URL(url);
URLConnection c = u.openConnection();
InputStream in = null;
String mediaType = null;
if (c instanceof HttpURLConnection) {
//c.setConnectTimeout(1000000);
//c.setReadTimeout(1000000);
HttpURLConnection h = (HttpURLConnection)c;
h.setRequestMethod("POST");
//h.setChunkedStreamingMode(-1);
setAccept(h, expectedMimeType);
h.setRequestProperty("Content-Type", inputMimeType);
for(String key: httpHeaders.keySet()) {
h.setRequestProperty(key, httpHeaders.get(key));
if (logger.isDebugEnabled()) {
logger.debug("Request property key : " + key + " / value : " + httpHeaders.get(key));
}
}
h.setDoOutput(true);
h.connect();
OutputStream out = h.getOutputStream();
out.write(input.getBytes());
out.close();
mediaType = h.getContentType();
logger.debug(" ------------------ sleep ------------------ START");
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
logger.debug(" ------------------ sleep ------------------ END");
if (h.getResponseCode() < 400) {
in = h.getInputStream();
} else {
in = h.getErrorStream();
}
It genearates the following HTTP headers
POST /emailauthentication/ HTTP/1.1
Accept: application/xml
Content-Type: application/xml
Authorization: OAuth oauth_consumer_key="b465472b-d872-42b9-030e-4e74b9b60e39",oauth_nonce="YnDb5eepuLm%2Fbs",oauth_signature="dbN%2FWeWs2G00mk%2BX6uIi3thJxlM%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1276524919", oauth_token="", oauth_version="1.0"
User-Agent: Java/1.6.0_20
Host: test:6580
Connection: keep-alive
Content-Length: 1107
In other posts it was suggested to turn off keep-alive by using the
http.keepAlive=false
system property, I tried that and the headers changed to
POST /emailauthentication/ HTTP/1.1
Accept: application/xml
Content-Type: application/xml
Authorization: OAuth oauth_consumer_key="b465472b-d872-42b9-030e-4e74b9b60e39", oauth_nonce="Eaiezrj6X4Ttt0", oauth_signature="ND9fAdZMqbYPR2j%2FXUCZmI90rSI%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1276526608", oauth_token="", oauth_version="1.0"
User-Agent: Java/1.6.0_20
Host: test:6580
Connection: close
Content-Length: 1107
the Connection header is "close" but I still cannot read the whole response. Any idea what do I do wrong?
It looks like JavaScript does not have access to authentication cookies ('ASP.NET_SessionId', '.ASPXFORMSAUTH')
in the http headers I can see cookies but document.cookie object does not have them.
Search for good JAVA lib for playing with POST-GET requests - Is there any such lib or how to play with POST - GETS from pure JAVA? How to create costume headers and so on.
I've just converted a project from MVC1 to MVC2. In the MVC1 project the HTTP status code was being set in some of the views. These views are now generating this exception:
Server cannot set status after HTTP headers have been sent.
What has changed from MVC1 to MVC2 to cause this and is there any way to fix this?
I am so frustrated right now after several hours trying to find where the hell is shared_ptr located at. None of the examples i see show complete code to include the headers for shared_ptr (and working). simply stating "std" "tr1" and "" is not helping at all! I have downloaded boosts and all but still it doesn't show up! Can someone help me by telling exactly where to find it?
Thanks for letting me vent my frustrations!
Hey, super newbie question. Consider the following WCF function:
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class Service1
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
[WebInvoke(UriTemplate = "",
Method = "POST",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare) ]
public SomeObject DoPost(string someText)
{
...
return someObject;
In fiddler what would my request headers and body look like?
Thanks for the help.
I am getting confused on why the compiler is not recognizing my classes. So I am just going to show you my code and let you guys decide. My error is this
error C2653: 'RenderEngine' : is not a class or namespace name
and it's pointing to this line
std::vector<RenderEngine::rDefaultVertex> m_verts;
Here is the code for rModel, in its entirety. It contains the varible. the class that holds it is further down.
#ifndef _MODEL_H
#define _MODEL_H
#include "stdafx.h"
#include <vector>
#include <string>
//#include "RenderEngine.h"
#include "rTri.h"
class rModel {
public:
typedef tri<WORD> sTri;
std::vector<sTri> m_tris;
std::vector<RenderEngine::rDefaultVertex> m_verts;
std::wstring m_name;
ID3D10Buffer *m_pVertexBuffer;
ID3D10Buffer *m_pIndexBuffer;
rModel( const TCHAR *filename );
rModel( const TCHAR *name, int nVerts, int nTris );
~rModel();
float GenRadius();
void Scale( float amt );
void Draw();
//------------------------------------ Access functions.
int NumVerts(){ return m_verts.size(); }
int NumTris(){ return m_tris.size(); }
const TCHAR *Name(){ return m_name.c_str(); }
RenderEngine::cDefaultVertex *VertData(){ return &m_verts[0]; }
sTri *TriData(){ return &m_tris[0]; }
};
#endif
at the very top of the code there is a header file
#include "stdafx.h"
that includes this
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include "resource.h"
#include "d3d10.h"
#include "d3dx10.h"
#include "dinput.h"
#include "RenderEngine.h"
#include "rModel.h"
// TODO: reference additional headers your program requires here
as you can see, RenderEngine.h comes before rModel.h
#include "RenderEngine.h"
#include "rModel.h"
According to my knowledge, it should recognize it. But on the other hand, I am not really that great with organizing headers. Here my my RenderEngine Declaration.
#pragma once
#include "stdafx.h"
#define MAX_LOADSTRING 100
#define MAX_LIGHTS 10
class RenderEngine {
public:
class rDefaultVertex
{
public:
D3DXVECTOR3 m_vPosition;
D3DXVECTOR3 m_vNormal;
D3DXCOLOR m_vColor;
D3DXVECTOR2 m_TexCoords;
};
class rLight
{
public:
rLight()
{
}
D3DXCOLOR m_vColor;
D3DXVECTOR3 m_vDirection;
};
static HINSTANCE m_hInst;
HWND m_hWnd;
int m_nCmdShow;
TCHAR m_szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR m_szWindowClass[MAX_LOADSTRING]; // the main window class name
void DrawTextString(int x, int y, D3DXCOLOR color, const TCHAR *strOutput);
//static functions
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
bool InitWindow();
bool InitDirectX();
bool InitInstance();
int Run();
void ShutDown();
void AddLight(D3DCOLOR color, D3DXVECTOR3 pos);
RenderEngine()
{
m_screenRect.right = 800;
m_screenRect.bottom = 600;
m_iNumLights = 0;
}
protected:
RECT m_screenRect;
//direct3d Members
ID3D10Device *m_pDevice; // The IDirect3DDevice10
// interface
ID3D10Texture2D *m_pBackBuffer; // Pointer to the back buffer
ID3D10RenderTargetView *m_pRenderTargetView; // Pointer to render target view
IDXGISwapChain *m_pSwapChain; // Pointer to the swap chain
RECT m_rcScreenRect; // The dimensions of the screen
ID3D10Texture2D *m_pDepthStencilBuffer;
ID3D10DepthStencilState *m_pDepthStencilState;
ID3D10DepthStencilView *m_pDepthStencilView;
//transformation matrixs system
D3DXMATRIX m_mtxWorld;
D3DXMATRIX m_mtxView;
D3DXMATRIX m_mtxProj;
//pointers to shaders matrix varibles
ID3D10EffectMatrixVariable* m_pmtxWorldVar;
ID3D10EffectMatrixVariable* m_pmtxViewVar;
ID3D10EffectMatrixVariable* m_pmtxProjVar;
//Application Lights
rLight m_aLights[MAX_LIGHTS]; // Light array
int m_iNumLights; // Number of active lights
//light pointers from shader
ID3D10EffectVectorVariable* m_pLightDirVar;
ID3D10EffectVectorVariable* m_pLightColorVar;
ID3D10EffectVectorVariable* m_pNumLightsVar;
//Effect members
ID3D10Effect *m_pDefaultEffect;
ID3D10EffectTechnique *m_pDefaultTechnique;
ID3D10InputLayout* m_pDefaultInputLayout;
ID3DX10Font *m_pFont; // The font used for rendering text
// Sprites used to hold font characters
ID3DX10Sprite *m_pFontSprite;
ATOM RegisterEngineClass();
void DoFrame(float);
bool LoadEffects();
void UpdateMatrices();
void UpdateLights();
};
The classes are defined within the class
class rDefaultVertex
{
public:
D3DXVECTOR3 m_vPosition;
D3DXVECTOR3 m_vNormal;
D3DXCOLOR m_vColor;
D3DXVECTOR2 m_TexCoords;
};
class rLight
{
public:
rLight()
{
}
D3DXCOLOR m_vColor;
D3DXVECTOR3 m_vDirection;
};
Not sure if thats good practice, but I am just going by the book.
In the end, I just need a good way to organize it so that rModel recognizes RenderEngine. and if possible, the other way around.
Hi,
I was wondering if anyone knows how to write an actual table/grid to a csv file....i dont mean the content of the table/grid, i mean the actual grid lines etc etc, headers, axis.....
Thanks greatly in advance.
U.
I'm using Netbeans 6.9 RC2 and Maven OSGi Bundle project template. Actually i dont want to test my bundles in Netbeans environment so i copy the jar file to the OSGi container directory and install it from command line. But when i want to see its headers from OSGi console, i see a lot of Netbeans related unnecessary stuff. Is it possible to edit the contents of the manifest file in Netbeans?
there is one think, i can't understand anyway:(((
when i try to set cookie(it is on line 28 in login.php), browser returns me an error!!!
Cannot modify header information - headers already sent by (output started at C:\xampp2\htdocs\video\index.php:9) in C:\xampp2\htdocs\video\login.php on line 28
but on line 9 in index php, i haven't any header!!! there is a tag!!!
i cant understand it!!! can somebody tall me why it returns me such error?
I need to solve a system of linear equations in my program. Is there a simple linear algebra library for C++, preferably comprised of no more than a few headers? I've been looking for nearly an hour, and all the ones I found require messing around with Linux, compiling DLLs in MinGW, etc. etc. etc. (I'm using Visual Studio 2008.)
def mailTo(subject,msg,folks)
begin
Net::SMTP.start('localhost', 25) do |smtp|
smtp.send_message "MIME-Version: 1.0\nContent-type: text/html\nSubject: #{subject}\n#{msg}\n#{DateTime.now}\n", '[email protected]', folks
end
rescue => e
puts "Emailing Sending Error - #{e}"
end
end
when the HTML is VERY large I get this exception
Emailing Sending Error - 552 5.6.0 Headers too large (32768 max)
how can i get a larger html above max to work with Net::SMTP in Ruby
Use a Content Delivery Network (CDN)
Compress components with gzip
Configure entity tags (ETags)
Add Expires headers
If i don't have access to Apache configuration.
Hello (this is a long post sorry),
I am writing a application in ASP.NET MVC 2 and I have reached a point where I am receiving this error when I connect remotely to my Server.
Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.
I thought I had worked around this problem locally, as I was getting this error in debug when site was redirected to a baseUrl if a subdomain was invalid using this code:
protected override void Initialize(RequestContext requestContext)
{
string[] host = requestContext.HttpContext.Request.Headers["Host"].Split(':');
_siteProvider.Initialise(host, LiveMeet.Properties.Settings.Default["baseUrl"].ToString());
base.Initialize(requestContext);
}
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (Site == null)
{
string[] host = filterContext.HttpContext.Request.Headers["Host"].Split(':');
string newUrl;
if (host.Length == 2)
newUrl = "http://sample.local:" + host[1];
else
newUrl = "http://sample.local";
Response.Redirect(newUrl, true);
}
ViewData["Site"] = Site;
base.OnActionExecuting(filterContext);
}
public Site Site
{
get
{
return _siteProvider.GetCurrentSite();
}
}
The Site object is returned from a Provider named siteProvider, this does two checks, once against a database containing a list of all available subdomains, then if that fails to find a valid subdomain, or valid domain name, searches a memory cache of reserved domains, if that doesn't hit then returns a baseUrl where all invalid domains are redirected.
locally this worked when I added the true to Response.Redirect, assuming a halting of the current execution and restarting the execution on the browser redirect.
What I have found in the stack trace is that the error is thrown on the second attempt to access the database.
#region ISiteProvider Members
public void Initialise(string[] host, string basehost)
{
if (host[0].Contains(basehost))
host = host[0].Split('.');
Site getSite = GetSites().WithDomain(host[0]);
if (getSite == null)
{
sites.TryGetValue(host[0], out getSite);
}
_site = getSite;
}
public Site GetCurrentSite()
{
return _site;
}
public IQueryable<Site> GetSites()
{
return from p in _repository.groupDomains
select new Site
{
Host = p.domainName,
GroupGuid = (Guid)p.groupGuid,
IsSubDomain = p.isSubdomain
};
}
#endregion
The Linq query ^^^ is hit first, with a filter of WithDomain, the error isn't thrown till the WithDomain filter is attempted.
In summary: The error is hit after the page is redirected, so the first iteration is executing as expected (so permissions on the database are correct, user profiles etc) shortly after the redirect when it filters the database query for the possible domain/subdomain of current redirected page, it errors out.
In my past applications I have been #importing into my *.h files where needed. I have not really thought much about this before as I have not had any problems, but today I spotted something that got me to thinking that maybe I should be #import-ing into my .m files and using @class where needed in the headers (.h) Can anyone shine any light on the way its supposed to be done or best practice?
gary
I'm trying to call a webservice with Soap in PHP5, for this, I need to use WS-Security 1.1.
(In java and .NET this is all generated automatically.)
Are there any frameworks available to generate the security headers easily in PHP? Or do I have to add the entire header myself ?
Specifications of WS-Security 1.1: http://oasis-open.org/committees/download.php/16790/wss-1.1-spec-os-SOAPMessageSecurity.pdf
Yesterday I posted this queston.
Today I found the code which I need but written in Ruby. Some parts of code I have understood (I don't know Ruby) but there is one part that I can't. I think people who know ruby and php can
help me understand this code.
def do_create(image)
# Clear any old info in case of a re-submit
FIELDS_TO_CLEAR.each { |field| image.send(field+'=', nil) }
image.save
# Compose request
vm_params = Hash.new
# Submitting a file in ruby requires opening it and then reading the contents into the post body
file = File.open(image.filename_in, "rb")
# Populate the parameters and compute the signature
# Normally you would do this in a subroutine - for maximum clarity all
# parameters are explicitly spelled out here.
vm_params["image"] = file # Contents will be read by the multipart object created below
vm_params["image_checksum"] = image.image_checksum
vm_params["start_job"] = 'vectorize'
vm_params["image_type"] = image.image_type if image.image_type != 'none'
vm_params["image_complexity"] = image.image_complexity if image.image_complexity != 'none'
vm_params["image_num_colors"] = image.image_num_colors if image.image_num_colors != ''
vm_params["image_colors"] = image.image_colors if image.image_colors != ''
vm_params["expire_at"] = image.expire_at if image.expire_at != ''
vm_params["licensee_id"] = DEVELOPER_ID
#in php it's like this $vm_params["sequence_number"] = -rand(100000000);?????
vm_params["sequence_number"] = Kernel.rand(1000000000) # Use a negative value to force an error when calling the test server
vm_params["timestamp"] = Time.new.utc.httpdate
string_to_sign =
CREATE_URL + # Start out with the URL being called...
#vm_params["image"].to_s + # ... don't include the file per se - use the checksum instead
vm_params["image_checksum"].to_s + # ... then include all regular parameters
vm_params["start_job"].to_s +
vm_params["image_type"].to_s +
vm_params["image_complexity"].to_s + # (nil.to_s => '', so this is fine for vm_params we don't use)
vm_params["image_num_colors"].to_s +
vm_params["image_colors"].to_s +
vm_params["expire_at"].to_s +
vm_params["licensee_id"].to_s + # ... then do all the security parameters
vm_params["sequence_number"].to_s +
vm_params["timestamp"].to_s
vm_params["signature"] = sign(string_to_sign) #no problem
# Workaround class for handling multipart posts
mp = Multipart::MultipartPost.new
query, headers = mp.prepare_query(vm_params) # Handles the file parameter in a special way (see /lib/multipart.rb)
file.close # mp has read the contents, we can close the file now
response = post_form(URI.parse(CREATE_URL), query, headers)
logger.info(response.body)
response_hash = ActiveSupport::JSON.decode(response.body) # Decode the JSON response string
##I have understood below
def sign(string_to_sign)
#logger.info("String to sign: '#{string_to_sign}'")
Base64.encode64(HMAC::SHA1.digest(DEVELOPER_KEY, string_to_sign))
end
# Within Multipart modul I have this:
class MultipartPost
BOUNDARY = 'tarsiers-rule0000'
HEADER = {"Content-type" => "multipart/form-data, boundary=" + BOUNDARY + " "}
def prepare_query (params)
fp = []
params.each {|k,v|
if v.respond_to?(:read)
fp.push(FileParam.new(k, v.path, v.read))
else
fp.push(Param.new(k,v))
end
}
query = fp.collect {|p| "--" + BOUNDARY + "\r\n" + p.to_multipart }.join("") + "--" + BOUNDARY + "--"
return query, HEADER
end
end
end
Thanks for your help.
When refactoring away some #defines I came across declarations similar to the following in a C++ header file:
static const unsigned int VAL = 42;
const unsigned int ANOTHER_VAL = 37;
The question is, what difference, if any, will the static make? Note that multiple inclusion of the headers isn't possible due to the classic #ifndef HEADER #define HEADER #endif trick (if that matters).
Does the static mean only one copy of VAL is created, in case the header is included by more than one source file?
Hi all -
I'm creating a flash application that will post images to a url for saving to disk/display later. I was wondering what are some suggested strategies for making this secure enough so that the upload is verified as coming from the application and not just some random form post.
Is it reliable enough to check referring location realizing that I don't need bulletproof security, or perhaps setting authentication headers is a better strategy even though it seems unreliable from what I have read.
Thanks for any advice - b
I was just checking an answer and realized that CHAR_BIT isn't defined by headers as I'd expect, not even by #include <bitset>, on newer GCC.
Do I really have to #include <climits> just to get the "functionality" of CHAR_BIT?
I have recently been experimenting with the tablesorter plugin for jQuery. I have successfully got it up and running in once instance, and am very impressed. However, I have tried to apply the tablesorter to a different table, only to encounter some difficulties...
Basically the table causing a problem has a <ul> above it which acts as a set of tabs for the table. so if you click one of these tabs, an AJAX call is made and the table is repopulated with the rows relevant to the specific tab clicked. When the page initially loads (i.e. before a tab has been clicked) the tablesorter functionality works exactly as expected.
But when a tab is clicked and the table repopulated, the functionality disappears, rendering it without the sortable feature. Even if you go back to the original tab, after clicking another, the functionality does not return - the only way to do so is a physical refresh of the page in the browser.
I have seen a solution which seems similar to my problem on this site, and someone recommends using the jQuery plugin, livequery. I have tried this but to no avail :-(
If someone has any suggestions I would be most appreciative. I can post code snippets if it would help (though I know the instantiation code for tablesorter is fine as it works on tables with no tabs - so it's definitely not that!)
EDIT:
As requested, here are some code snippets:
The table being sorted is <table id="#sortableTable#">..</table>, the instantiation code for tablesorter I am using is:
$(document).ready(function()
{
$("#sortableTable").tablesorter(
{
headers: //disable any headers not worthy of sorting!
{
0: { sorter: false },
5: { sorter: false }
},
sortMultiSortKey: 'ctrlKey',
debug:true,
widgets: ['zebra']
});
});
And I tried to rig up livequery as follows:
$("#sortableTable").livequery(function(){
$(this).tablesorter();
});
This has not helped though... I am not sure whether I should use the id of the table with livequery as it is the click on the <ul> I should be responding to, which is of course not part of the table itself. I have tried a number of variations in the hope that one of them will help, but to no avail :-(
Hi,
I am trying to read the boost headers to figure out how they managed to implement the
or_<...>
and
and_<...>
metafunctions so that:
1) They can have an arbitrary number of arguments (ok, say up to 5 arguments)
2) They have short circuit behavior, for example:
or_<false_,true_,...>
does not instantiate whatever is after true_ (so it can also be declared but not defined)
Unfortunately the pre-processor metaprogramming is making my task impossible for me :P
Thank you in advance for any help/suggestion.