Linq data structuring
Gentlemen,
I have two issues I'm struggling with LINQ. I appreciate if you could
advise. I have 2 lists rawStates (storing rows of
entity-downtime-uptime-eventtype) and rawData list storing products' in
and out times from entity.
(1) I want to select those elements from rawStates that occurred when
still waiting for that entity to be processed
foreach(var t in rawData) var s = rawStates.Where(o=>o.Entity == t.Entity
&& o.DownDate > t.InTime && o.Update
(2) If I group my rawData by productID (there are multiple rows with same
ProductID), how can I revert back this "s" to these groups so that for a
productID I can group by eventtype, and summarise durations by productID?
Thanks in advance.
Tuesday, 3 September 2013
How are printer notifications in Windows supposed to work with network printers?
How are printer notifications in Windows supposed to work with network
printers?
I have an application which needs to print files of different types using
their associated applications for printing using ShellExecute and the
"print" verb. My application needs to (hopefully) reliably know when one
print job is completely processed and it can issue the next one. I
accomplish this using FindNextPrinterChangeNotification and everything
seems to work fine using local printers, e.g. installed via USB, but I get
a completely different behavior if network printers are involved.
One of my clients used my application with a network printer, meaning a
professional printer with it's own print server embedded, installed on a
Windows Server 2008 R2 and shared this installed printer using Windows to
it's clients. In this scenario FindNextPrinterChangeNotification always
returned success, but it's returned structures got the flag
PRINTER_NOTIFY_INFO_DISCARDED set always as well. I could reproduce this
behavior with a Windows Server 2008 R2 on my own which didn't export a
printer with it's own embedded printer server, but simply a locally
installed FreePDF XP. Additionally, I get the same behavior if I use
samba, cups and cups-pdf on one of our Ubuntu development servers: Samba
successfully exports the cups-pdf printer and if I install it in my
Windows 7 development machine and use it with my print application,
FindNextPrinterChangeNotification returns successfully always, but again
always with the flag PRINTER_NOTIFY_INFO_DISCARDED set.
My customer afterwards installed his printer directly via the printer's
embedded print server to it's clients and told me that my print
application is now working as with a local printer. Meaning no more events
with PRINTER_NOTIFY_INFO_DISCARDED flag set as in his version of my
application this is an error state which would exit the application.
I tried to reproduce that using cups-pdf again, this time I didn't install
the printer exported by Samba, but directly by specifying the printer name
of cups using the URL http://domain.example.org:631/printers/PDF. I can
successfully use this printer in Windows, but my application again gets
strange events. This time I don't get results with the flag
PRINTER_NOTIFY_INFO_DISCARDED set, but ppPrinterNotifyInfo is always NULL,
I don't get any results at all, but FindNextPrinterChangeNotification
returns successfully.
Microsoft provides a note about Firewalls and printer notifications may
get blocked by clients, but I don't think that this is the problem in my
case because I already tested the same scenarios with a disabled firewall,
with enabled firewall the results differ depending on how my development
machine is speaking to the printers and my Windows 7 firewall settings
seem to allow printer communication by default.
To make a long story short: I didn't find anything on how reliable printer
notifications are for different network printers. Is everything depending
on the printer drivers? Doesn't seem so because it makes a different if
Samba exports a printer or one uses http directly. From what I've read
Windows 7 uses client rendering of print jobs and afterwards sends the
jobs to the network spooler, I can see those jobs in my local spooler for
a long time. Why don't I get notifications as well? Are Samba and printers
shared using a Windows Server by design not supposed to publish printer
notifications? I couldn't find any info saying that.
I would really appreciate any help or hints for docs which could provide
some light on this. Thanks!
printers?
I have an application which needs to print files of different types using
their associated applications for printing using ShellExecute and the
"print" verb. My application needs to (hopefully) reliably know when one
print job is completely processed and it can issue the next one. I
accomplish this using FindNextPrinterChangeNotification and everything
seems to work fine using local printers, e.g. installed via USB, but I get
a completely different behavior if network printers are involved.
One of my clients used my application with a network printer, meaning a
professional printer with it's own print server embedded, installed on a
Windows Server 2008 R2 and shared this installed printer using Windows to
it's clients. In this scenario FindNextPrinterChangeNotification always
returned success, but it's returned structures got the flag
PRINTER_NOTIFY_INFO_DISCARDED set always as well. I could reproduce this
behavior with a Windows Server 2008 R2 on my own which didn't export a
printer with it's own embedded printer server, but simply a locally
installed FreePDF XP. Additionally, I get the same behavior if I use
samba, cups and cups-pdf on one of our Ubuntu development servers: Samba
successfully exports the cups-pdf printer and if I install it in my
Windows 7 development machine and use it with my print application,
FindNextPrinterChangeNotification returns successfully always, but again
always with the flag PRINTER_NOTIFY_INFO_DISCARDED set.
My customer afterwards installed his printer directly via the printer's
embedded print server to it's clients and told me that my print
application is now working as with a local printer. Meaning no more events
with PRINTER_NOTIFY_INFO_DISCARDED flag set as in his version of my
application this is an error state which would exit the application.
I tried to reproduce that using cups-pdf again, this time I didn't install
the printer exported by Samba, but directly by specifying the printer name
of cups using the URL http://domain.example.org:631/printers/PDF. I can
successfully use this printer in Windows, but my application again gets
strange events. This time I don't get results with the flag
PRINTER_NOTIFY_INFO_DISCARDED set, but ppPrinterNotifyInfo is always NULL,
I don't get any results at all, but FindNextPrinterChangeNotification
returns successfully.
Microsoft provides a note about Firewalls and printer notifications may
get blocked by clients, but I don't think that this is the problem in my
case because I already tested the same scenarios with a disabled firewall,
with enabled firewall the results differ depending on how my development
machine is speaking to the printers and my Windows 7 firewall settings
seem to allow printer communication by default.
To make a long story short: I didn't find anything on how reliable printer
notifications are for different network printers. Is everything depending
on the printer drivers? Doesn't seem so because it makes a different if
Samba exports a printer or one uses http directly. From what I've read
Windows 7 uses client rendering of print jobs and afterwards sends the
jobs to the network spooler, I can see those jobs in my local spooler for
a long time. Why don't I get notifications as well? Are Samba and printers
shared using a Windows Server by design not supposed to publish printer
notifications? I couldn't find any info saying that.
I would really appreciate any help or hints for docs which could provide
some light on this. Thanks!
Display as grid from JSON in Zend framework 2
Display as grid from JSON in Zend framework 2
I am new in zf2. I have to display list of data from database and add,
edit, delete operations using JSON. I am using this code to convert the
data into JSON.
public function getList()
{
$results = $this->getAlbumTable()->fetchAll();
$data = array();
foreach($results as $result) {
$data[] = $result;
}
return new JsonModel(array(
'data' => $data,
));
}
But I don't know how to display data from this JSON. I searched and didn't
get any correct codes. Please help me.
I am new in zf2. I have to display list of data from database and add,
edit, delete operations using JSON. I am using this code to convert the
data into JSON.
public function getList()
{
$results = $this->getAlbumTable()->fetchAll();
$data = array();
foreach($results as $result) {
$data[] = $result;
}
return new JsonModel(array(
'data' => $data,
));
}
But I don't know how to display data from this JSON. I searched and didn't
get any correct codes. Please help me.
Google Play Services onRoomCreated error
Google Play Services onRoomCreated error
i'm developing a multiplayer online game using Google Play Services and i
have this problem. SOMETIMES when i try to invite a player or to start a
quick game, it returns error status 2, which is
"STATUS_CLIENT_RECONNECT_REQUIRED".
So i tried to reconnect the client using this method:
reconnectClients(BaseGameActivity.CLIENT_APPSTATE);
But it doesn't work. I don't understand why sometimes it works and
sometimes not..
Thank you!
i'm developing a multiplayer online game using Google Play Services and i
have this problem. SOMETIMES when i try to invite a player or to start a
quick game, it returns error status 2, which is
"STATUS_CLIENT_RECONNECT_REQUIRED".
So i tried to reconnect the client using this method:
reconnectClients(BaseGameActivity.CLIENT_APPSTATE);
But it doesn't work. I don't understand why sometimes it works and
sometimes not..
Thank you!
if condtion doesnt works on my robot
if condtion doesnt works on my robot
I created a small robot that stole money from peoples..
I used java code to create this robot...
whwn it saw some rich people... it must steal cash from them...
i use these codes for this purpose..
var people ;
if(people==='rich')
{
look();
run();
stole();
runback();
}
but after created this code this robot stole my own money and gave it to
other peoples.. why this happen .. what is the problems in this code?
please help.. now i cant live because of this robot... please hep me ....
i used the same robot for killing mosquitoes... But now it think my (**)
as mosquito and try to kill it...
please help....
I created a small robot that stole money from peoples..
I used java code to create this robot...
whwn it saw some rich people... it must steal cash from them...
i use these codes for this purpose..
var people ;
if(people==='rich')
{
look();
run();
stole();
runback();
}
but after created this code this robot stole my own money and gave it to
other peoples.. why this happen .. what is the problems in this code?
please help.. now i cant live because of this robot... please hep me ....
i used the same robot for killing mosquitoes... But now it think my (**)
as mosquito and try to kill it...
please help....
Monday, 2 September 2013
I am trying to set a chess board texture for a square
I am trying to set a chess board texture for a square
I am trying to set a chess board texture with green and blue texels for a
square. Instead my square is black. I don't get any compile or runtime
errors. Is there any problem with my texture code?
vector<unsigned char> texelsBuffer;
for(int i = 0; i < N; ++i)
for(int j = 0; j < N; ++j)
{
texelsBuffer.push_back(0.0f);
if((i+j) % 2 == 0) {
texelsBuffer.push_back(1.0f);
texelsBuffer.push_back(0.0f);
}
else {
texelsBuffer.push_back(0.0f);
texelsBuffer.push_back(1.0f);
}
texelsBuffer.push_back(1.0f);
}
ID3D11Texture2D* tex = 0;
D3D11_TEXTURE2D_DESC textureDescr;
ZeroMemory(&textureDescr, sizeof(D3D11_TEXTURE2D_DESC));
textureDescr.ArraySize = 1;
textureDescr.BindFlags = D3D11_BIND_SHADER_RESOURCE;
textureDescr.CPUAccessFlags = 0;
textureDescr.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
textureDescr.Height = N;
textureDescr.Width = N;
textureDescr.MipLevels = 1;
textureDescr.MiscFlags = 0;
textureDescr.SampleDesc.Count = 1;
textureDescr.SampleDesc.Quality = 0;
textureDescr.Usage = D3D11_USAGE_IMMUTABLE;
D3D11_SUBRESOURCE_DATA texInitData;
ZeroMemory(&texInitData, sizeof(D3D11_SUBRESOURCE_DATA));
texInitData.pSysMem = (void*)&texelsBuffer[0];
texInitData.SysMemPitch = sizeof(unsigned char) * N;
texInitData.SysMemSlicePitch = 0;
g_pd3dDevice->CreateTexture2D(&textureDescr, &texInitData, &tex);
g_pd3dDevice->CreateShaderResourceView(tex, NULL, &g_pTextureRV);
Or my sampler code?
D3D11_SAMPLER_DESC sampDesc;
ZeroMemory( &sampDesc, sizeof(sampDesc) );
sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
sampDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
sampDesc.MinLOD = 0;
sampDesc.MaxLOD = D3D11_FLOAT32_MAX;
g_pd3dDevice->CreateSamplerState(&sampDesc, &g_pSamplerLinear);
I am trying to set a chess board texture with green and blue texels for a
square. Instead my square is black. I don't get any compile or runtime
errors. Is there any problem with my texture code?
vector<unsigned char> texelsBuffer;
for(int i = 0; i < N; ++i)
for(int j = 0; j < N; ++j)
{
texelsBuffer.push_back(0.0f);
if((i+j) % 2 == 0) {
texelsBuffer.push_back(1.0f);
texelsBuffer.push_back(0.0f);
}
else {
texelsBuffer.push_back(0.0f);
texelsBuffer.push_back(1.0f);
}
texelsBuffer.push_back(1.0f);
}
ID3D11Texture2D* tex = 0;
D3D11_TEXTURE2D_DESC textureDescr;
ZeroMemory(&textureDescr, sizeof(D3D11_TEXTURE2D_DESC));
textureDescr.ArraySize = 1;
textureDescr.BindFlags = D3D11_BIND_SHADER_RESOURCE;
textureDescr.CPUAccessFlags = 0;
textureDescr.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
textureDescr.Height = N;
textureDescr.Width = N;
textureDescr.MipLevels = 1;
textureDescr.MiscFlags = 0;
textureDescr.SampleDesc.Count = 1;
textureDescr.SampleDesc.Quality = 0;
textureDescr.Usage = D3D11_USAGE_IMMUTABLE;
D3D11_SUBRESOURCE_DATA texInitData;
ZeroMemory(&texInitData, sizeof(D3D11_SUBRESOURCE_DATA));
texInitData.pSysMem = (void*)&texelsBuffer[0];
texInitData.SysMemPitch = sizeof(unsigned char) * N;
texInitData.SysMemSlicePitch = 0;
g_pd3dDevice->CreateTexture2D(&textureDescr, &texInitData, &tex);
g_pd3dDevice->CreateShaderResourceView(tex, NULL, &g_pTextureRV);
Or my sampler code?
D3D11_SAMPLER_DESC sampDesc;
ZeroMemory( &sampDesc, sizeof(sampDesc) );
sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
sampDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
sampDesc.MinLOD = 0;
sampDesc.MaxLOD = D3D11_FLOAT32_MAX;
g_pd3dDevice->CreateSamplerState(&sampDesc, &g_pSamplerLinear);
Share link of famous social websites and blog makers
Share link of famous social websites and blog makers
I need share links of famous social networks like facebook, blogger,
linkedin, google plus,... how do I get these. I need something like this :
https://www.facebook.com/sharer/sharer.php?u=+encodeURIComponent(LINK) how
can i get them ?
I need share links of famous social networks like facebook, blogger,
linkedin, google plus,... how do I get these. I need something like this :
https://www.facebook.com/sharer/sharer.php?u=+encodeURIComponent(LINK) how
can i get them ?
Subscribe to:
Posts (Atom)