I have a string hai-welcome.
I need to split the above string using - separator:
mySstring = "hai-welcome"
Seperate as:
firstString = "hai"
secondString = "welcome.
I have a string hai-welcome.
I need to split the above string using - separator:
mySstring = "hai-welcome"
Seperate as:
firstString = "hai"
secondString = "welcome.
Tell me if I'm wrong: LastPass can never see my passwords, because they are encrypted with a key that stays in my own computer?
Then how is it possible that I can use my passwords from another computer?
My only guess is that the key is the password I use to login to LastPass, or at least it is generated based on it, so it is related in some way. So when I login to LastPass from another computer, they key same key is created in that computer.
I am using BasicHttpBinding
to connect a web service hosted on a secured (https) port. To get it working, I have changed the Security.Mode
to TransportWithMessageCredential
and Security.Message
to BasicHttpMessageCredentialType.Cerificate
. I am also calling
client.ClientCredentials.ClientCertificate.SetCertificate()
with localhost as the subject name.
The issue here is that for unit testing, I have an unsigned certificate from the web server and am supposed to ignore any certificate error thrown during the proxy creation; but I am unable to do so, because I keep getting an error telling me to "specify a certificate". Right now, I am clueless; I appreciate any help here.
Well I would like to get an unique CPU ID so I can get an UNIQUE identification for each machine.
I did check __cpuid() from windows.h library, but the problem is that the ID it gets, it's the ID of all types of CPU, if you have an I3 Core processor and I have an I3 core processor, it will give the same "Unique ID".
Here is what I came up with to make a CPU ID from the __cpuid() that returns the same information on processors of the same type:
std::string GetCPUID(){
int CPUInfo[4] = {-1};
__cpuid(CPUInfo, 0);
if (CPUInfo[0] < 4)
return ""; //Error on retrieving
stringstream st;
for(int i = 0; i <= 3; i++){
st << CPUInfo[i];
}
return st.str();
}
I also checked a program called "Hardware ID Extractor" that works fine, it actually returns a UNIQUE CPU ID as the GUI as I wanted, so they made available a DLL so we can extract the CPU ID it generated , I tried everything with the cleanest code with the DLL and following their example but it seems that it returns nothing when ran on Windows 7. a lot of other people were complaining about this on Windows 7 via the DLL, even though the GUI on windows 7 returns the correct CPU ID.
Showing my work in the Hardware ID Extractor,
Here is the site where I downloaded the DLL (Where I chose the link of C++, VB, .NET): http://www.soft.tahionic.com/download-hdd_id/free-download/free%20download.html
And here is the DLL itself to download: http://www.soft.tahionic.com/download-hdd_id/free-download/DLL%20compressed/HardwareIDExtractorC.dll
This is the code I got from Hardware ID Extractor (I'm using Visual Studio 2008):
#include <iostream>
#include <windows.h>
#include <conio.h>
using namespace std;
int main (){
char* (__stdcall *GetIDESerialNumber)(BYTE);
HINSTANCE DllInst = NULL;
if (DllInst == NULL) DllInst = LoadLibrary("C:\\HardwareIDExtractorC.dll");
if (DllInst) {
GetIDESerialNumber = (char* (__stdcall*)(BYTE))GetProcAddress(DllInst, "GetIDESerialNumber");
//Now call the imported function
cout << "SN: " << GetIDESerialNumber(0); // 0 = first IDE hard drive in your system
}else{
printf("Not Loaded");
}
_getch();
return 0;
}
In the visual studio output it shows that the DLL was executed by saying:
'Test.exe': Loaded 'C:\HardwareIDExtractorC.dll', Binary was not built with debug information.
And the program output that I get is: Not loaded
Someone know what I can do to get a CPU ID Unique, like in the application Hardware ID Extractor? I need to get a CPU ID because if I get HDD information, the user may format their Hard Drive and the program will stop working, as I'm designing it to work only that specified computer.
I'm using Windows 7 32 bits Ultimate and Intel I3 Core Processor (if that helps in anyway).
I hope I was clear in my question.
Thanks in advance!
Here is the idea:
The user types in a command which it has to be send to an android device.
Then the android device runs the command and returns the result to the php page which displays the result in the page!
I have tried with sockets but with no luck(i wanted to keep a connection alive until the closure of the page).
I know how to run commands in my android device:
Runtime.getRuntime().exec( command,args);
And I also know how to send data to the php server:
HttpPost httppost = new HttpPost("http://192.168.10.21/epl371/index.php?");
etc...
The problem is that I want to send data to the android device first via the text box after pressing the submit button.
Is there a way to do this? Is HttpPost a wrong way to do this?
I have tried so many things like:
URL url = new URL(SERVER_URL);
URLConnection connection = url.openConnection();
etc..
I jus want to know, In Flex Datagrid If the pressed key is Enter, stop the propagation and dispatch a fake Tab Event.
Any suggesstion,
Thankxx
I am writing a little project to parse a CSS file, and base64 encode all the background images.
While I am able to parse the CSS correctly, it seems that everytime I try to convert the image file into a base64Encoded string, the string returned is always exactly the same.
What am I doing wrong?
Here's the encoder. Please assume that all image paths are passing correctly to the method. In this instance, all images are fully qualified urls, so the first section of the method is what is doing the conversion.
Public Sub EncodeImage(ByVal _File As String)
If _File.StartsWith("http") OrElse _File.StartsWith("https") Then
Using _wc As New WebClient()
Common.SetAllowUnsafeHeaderParsing20()
_wc.Headers.Add("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13")
_wc.DownloadFile(_File, "c:\temp.png")
Dim _d As Byte() = _wc.DownloadData(_File)
ImageStrings.Add(New ImageTyping() With {
.SourceFile = _File,
.Base64String = Convert.ToBase64String(_d)
})
_d = Nothing
End Using
Else
Using _fs As New FileStream(_File, IO.FileMode.Open)
Using _br As New BinaryReader(_fs)
Dim _i As Byte() = _br.ReadBytes(_fs.Length)
ImageStrings.Add(New ImageTyping() With {
.SourceFile = _File,
.Base64String = Convert.ToBase64String(_i)
})
_i = Nothing
_br.Close()
End Using
_fs.Close()
End Using
End If
End Sub
Each and every string returned from this is: iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAAGXcA1uAAAAKUlEQVRIx2P4//+/DwwzUJUzoiRGNYxqGNUwGDSMWjBqwagFoxbQAAMAfS9kqktT8qQAAAAASUVORK5CYII=
I want to place a view(firstView) back to another view(secondView). SecondView is basically a barchart using CGContext. I guess i can't use bringViewToFront there. So I need to place firstView back to secondView. Is there some default function to place a view back to some other view?
Thanks,
Nitish
How can i get this
nums = [(0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 6), (6, 7), (7, 8)]
to this?
[0, 1, 2, 3, 4, 5, 6, 7, 8]
I did:
>>> zip(*nums)[0]
(0, 1, 2, 3, 4, 5, 6, 7)
But it gives me everything except the last element and then i had to use some bad code to get it to the correct result so i was looking for an elegant solution.
I am working on Dreamweaver TBBs in SDL Tridion 2011 SP1.
I am unaware of handling component links in Dreamweaver TBBs.
Consider my Component name is "A" which has link to another component "B".
Component A source looks like this:
<Content xmlns="Some UUID">
<Name xlink:type="simple" xlink:href="tcm:184-1897"
xmlns:xlink="http://www.w3.org/1999/xlink" xlink:title="B"></Name>
</Content>
Component B source is:
<Content xmlns="Some other UUID">
<first>first field</first>
<second>second field</second>
</Content>
I want to write a DWT TBB which can access the fields in the linked component B from Component A.
I want to use RenderComponentField rendition method.
Do I need to add any extentions to it, will I be able apply SiteEdit on it.
Please share your views on it.
Thank you.
i want to build advanced search script but i have this error with search_all function in the model
A PHP Error was encountered
Severity: 4096
Message: Object of class CI_DB_mysql_result could not be converted to string
Filename: models/search_model.php
Line Number: 129
i have four fildes
1- input text to write the book name
2- select box for the author
3- select box for the publisher
3-select box for the section
the model is
class search_model extends CI_Model
{
function __construct()
{
parent::__construct();
}
/* This function get all search in database sort by order asc.*/
function get_new_one($id)
{
$this->db->where('ne_id',$id);
$result=$this->db->get('d_search');
return $result->row();
}
//////////////frontend//////////////////////////////////////////////////////////
function show_new($id)
{
$result=$this->db->query("SELECT * , COUNT( d_comments_search.cn_new_id ) as count
FROM d_search
left JOIN d_comments_search ON d_search.ne_id = d_comments_search.cn_new_id and d_search.ne_hide='1'
inner join d_search_category on d_search_category.nc_id = d_search.ne_category_id and d_search_category.nc_hide= '1'
and d_search.ne_id= $id group by d_search.ne_id");
return $result->row() ;
}
function generate_results($keyword,$row=0){
$result1 = $this->db->query("SELECT bo_id,bo_name,bo_state,bo_about FROM d_book where (bo_name like '%$keyword%' or bo_about like '%$keyword%') and bo_state = '1' limit $row,20");
$result2 = $this->db->query("SELECT au_id,au_name,au_state,au_info FROM d_author where (au_name like '%$keyword%' or au_info like '%$keyword%') and au_state = '1' limit $row,20");
$result3 = $this->db->query("SELECT pub_id,pub_name,pub_state,pub_info FROM d_publishing where (pub_name like '%$keyword%' or pub_info like '%$keyword%') and pub_state = '1' limit $row,20");
$results = array_merge($result1->result_array(),$result2->result_array(),$result3->result_array());
return $results;
}
// get total number of users
function getNumUsers($keyword)
{
$result1 = $this->db->query("SELECT bo_id,bo_name,bo_state,bo_about FROM d_book where (bo_name like '%$keyword%' or bo_about like '%$keyword%') and bo_state = '1'");
$result1 = $result1->num_rows();
$result2 = $this->db->query("SELECT au_id,au_name,au_state,au_info FROM d_author where (au_name like '%$keyword%' or au_info like '%$keyword%') and au_state = '1'");
$result2 = $result2->num_rows();
$result3 = $this->db->query("SELECT pub_id,pub_name,pub_state,pub_info FROM d_publishing where (pub_name like '%$keyword%' or pub_info like '%$keyword%') and pub_state = '1'");
$result3 = $result3->num_rows();
return $result1 + $result2 + $result3;
}
//////////////////////////////////end paging///////////////////
function get_publishing()
{
$this->db->where('pub_state','1');
$result=$this->db->get('d_publishing')->result_array();
return $result;
}
function get_author()
{
$this->db->where('au_state','1');
$result=$this->db->get('d_author')->result_array();
return $result;
}
function get_section()
{
$this->db->where('sec_state','1');
$result=$this->db->get('d_section')->result_array();
return $result;
}
function search_name()
{
$bo_name=$_POST['bo_name'];
$this->db->order_by("bo_ord","asc");
$this->db->like('bo_name',$bo_name);
return $this->db->get('d_book')->result_array();
}
function search_all() {
$publish = $this->input->post('publish');
$author = $this->input->post('author');
$sec_name = $this->input->post('section');
$sql = $this->db->query("SELECT * FROM `d_book`");
$searches = array();
if ($publish != 'choose')
$searches[] = "`bo_pub_id` = '$publish'";
if ($author != 'choose')
$searches[] = "`bo_au_id` = '$author'";
if ($sec_name != 'choose')
$searches[] = "`bo_sec_id` = '$sec_name'";
if (count($searches) > 0) {
$sql .= "WHERE " . implode(" AND ", $searches);
}
$sql .= ';';
}
}
this is controller
class Search extends front_end {
var $temp;
function __construct(){
parent::__construct();
$this->load->library('form_validation');
//echo $this->input->post("keyboard");
}
public function index()
{
$this->overview();
}
/**
* This function display all search
* @param integer $row
*/
public function overview($row=0)
{
$this->form_validation->set_rules('keyword', 'كلمة اÙ„بØØ«', 'trim|required|xss_clean|htmlspecialchars');
$this->form_validation->run();
$this->store_keyword();
//echo $this->session->flashdata('keyword');
if ($this->session->flashdata('keyword') != ''){
$keyword=$this->session->flashdata('keyword');
$this->generate_results($this->session->flashdata('keyword'),$row);
}else{
$this->generate_results($this->input->post("keyword"),$row);
}
//$this->session->set_flashdata('keyword', $this->input->post("keyword"));
$data = $this->temp;
//$this->session->keep_flashdata('keyword');
$this->view('search/site/results', $data);
}
/**
* This function generate result of search
* @param string $keyword
* @param integer $row
*/
public function generate_results($keyword,$row=0){
$this->load->model('search/search_model','search');
$this->load->library('pagination');
$config['base_url'] = base_url().'search/search/overview/';
$config['total_rows'] = $this->search->getNumUsers($keyword);
$config['per_page'] = '20';
$config['uri_segment'] = '4';
$this->pagination->initialize($config);
$data['page'] = $row;
$data['results'] = $this->search->generate_results($keyword,$row);
$data['total_rows'] = $this->search->getNumUsers($keyword);
$data['links']=$this->pagination->create_links();
$this->temp = $data;
}
/**
* This function display detail of new
* @param integer $id
*/
public function show($id)
{
$data['new']=$this->search->show_new($id);
$count=$data['new']->ne_count_visit;
$this->search->add_count($count,$id);
$data['comments']=$this->search->show_comments($id);
$this->view('site/new', $data);
}
/**
* This function store keyword to use in search
*/
private function store_keyword(){
if($this->input->post("keyword")){
$this->session->set_userdata('keyword', $this->input->post("keyword"));
}
}
public function search_form()
{
$this->load->model('search/search_model','search');
$data['publish']=$this->search->get_publishing();
$data['author']=$this->search->get_author();
$data['section']=$this->search->get_section();
$this->view('search/site/adv_search_form',$data);
}
public function search_adv()
{
$this->load->model('search/search_model','search');
$data['bo_name']=$this->input->post('bo_name');
$data['section']=$this->input->post('section');
$data['publish']=$this->input->post('publish');
$data['author']=$this->input->post('author');
$data['result1'] = '';
$data['result2'] = '';
$data['result3'] = '';
$data['result4'] = '';
if($data['bo_name'] == NULL and $data['section']== NULL and $data['publish']==NULL and $data['author']== NULL){
$this->search_form();
}else{
if(isset($data['bo_name']) and $data['bo_name']!= NULL)
{
$data['result1'] = $this->search->search_name();
}
if(isset($data['section']) and $data['section'] != NULL)
{
$data['result2']=$this->search->search_all();
}
if(isset($data['publish']) and $data['publish'] != NULL)
{
$data['result3']=$this->search->search_all();
}
if(isset($data['author']) and $data['author']!= NULL)
{
$data['result4']=$this->search->search_all();
}
$data['no_results'] = '';
if(! $data['result1'] && !$data['result2'] && !$data['result3'] && !$data['result4']){
$data['no_results'] = TRUE;
}else{
$data['no_results'] = FALSE;
}
$this->view('search/site/search_result',$data);
}
}
}
/* End of file dashboard.php */
I'm having troubles getting data from the system clipboard on Mac OS X.
What I'm trying to do is to listen to the system clipboard and print the content of the clipboard each time new [text based] information is put into it.
The problem: bellow code works perfectly fine on Windows 7 and openSuse Linux machines, however when I try running the same code on Mac OS X the program fails to print the new content of the clipboard until focus is given to the application. [Nothing is printed until I click on the application icon on the dock...]
My source code:
import java.awt.Toolkit;
import java.awt.datatransfer.*;
import java.io.IOException;
public class ClipboardListener extends Thread implements ClipboardOwner {
Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
public void run(){
Transferable selection = systemClipboard.getContents(this);
gainOwnership(selection);
}
public void gainOwnership(Transferable t){
try {this.sleep(100);}
catch (InterruptedException e) {e.printStackTrace();}
systemClipboard.setContents(t, this);
}
public void lostOwnership(Clipboard clipboard, Transferable contents) {
try {System.out.println((String) clipboard.getData(DataFlavor.stringFlavor));}
catch (UnsupportedFlavorException e) {}
catch (IOException e) {}
gainOwnership(contents);
}
}
public class myApp {
public static void main(String[] args){
ClipboardListener listener = new ClipboardListener();
listener.start();
while(true){}}
}
What I'm missing/doing wrong?
[Update]
I found similar problem posted here: Java thread goes to sleep when not in focus on OSX
However using the command "java -jar myApp.jar &" didn't work as a workaround for me.
how i can get to related text-box code in ollydbg?
example : i need text-box code in ollydbg but don't find this.
can this into the memory?
this program design by adobe director and need activation code, this code is unique and related to hardware id
thank you
Im building an app where users will be able to filter through a set of photos based on 4 parameters:
param1 and param2 can be one of three possible values respectively. param3 and param4 can contain multiple 'tags' if you will that describe the photo. I have the ui setup where for param1/param2 a series of uiswitches represents each of the three chooses for each param. If you turn one value on, the other two will turn off. However all off should return all photos assuming no values for param3 or param4 are set
Params3/4 have UiButtons that can be made selected/normal. Any selected should be added to the filtering to narrow results.
I can't seem to figure out how I should write the filtering logic to be most effective. Essentially on any control change, I need to rewrite the predicate filter but I can't seem to wrap my head around how I can link the separate param filters together.
For param3/4 I'd also like to add a disabled state for uibuttons that have no records, or no records based on the currently selected buttons.
Can anyone help point me in the right direction?
I have this code for view:
App.TodoView = Em.View.extend({
labelView: Em.TextField.extend({
}),
createNew:function () {
console.log(this.labelView.get('value'));
}
});
and this template:
{{#view App.TodoView}}
{{view labelView}}
{{#view Em.Button target="parentView" action="createNew"}}Add{{/view}}
{{/view}}
And I get the following error:
Uncaught TypeError: Object (subclass of Ember.TextField) has no method 'get'
I want to use insertNewLine method too, so I can set the value of the Em.TextField
in template.
I have a site with a bunch of (pretty ugly) classic asp pages, as well as a number of ASP.NET web forms pages. I need to be able to set it up so the user can flip a switch and translate the whole site to French.
Unfortunately, the requesting client does not want us to use something simple like google translate, they want to be in control of the dictionary to prevent errors in grammar, etc. This means I have to overcome two problems.
First, I need to parse out all of the hard coded text on the website that would be visible to the client and put it into a spreadsheet so they can translate it to their liking and send it back. I was trying to use the Html Agility Pack to do this with the classic code, but was having trouble handling cases where there are server tags (which there are an obscene amount of).
Second, I need a solution that will use this dictionary to translate the text, in both classic and ASP.NET.
I'm thinking the dictionary will be in XML, and could do the translation on the client side, so it will not have to deal with the server tags issue and will work in both classic and .NET, but I'm completely open to suggestion. If anyone has any ideas or knows of any kind of solution that will help me with one or both of my problems, I'd greatly appreciate any help. Thanks
I am not sure what to call this, all I can think of is a Repeater Button.
I want to press a button and it fires a function immediately once, eg MyZoom(InOrOut).
But if I keep the mouse button depressed it will keep firing that MyZoom(InOrOut) every one tenth of a second until I release the mouse button.
As you can probably guess from the function name, I will have 2 buttons, a zoom in and a zoom out. They will call MyZoom(-1) to make it smaller and MyZoom(1) to make it bigger.
<button onclick="MyZoom(-1);">Zoom Out</button>
<button onclick="MyZoom(1);">Zoom In</button>
How can I change this to include the repeating effect?
Nowadays, Developers and Professionals tend to use PHP templates because of two reasons. They are manageable and secondly, we don't need to advertise our technology as there are no question marks and .php extensions within the URL.
But how to make non-advertisement of your technology possible while sending a jQuery Ajax request to load a PHP file in a div
. I mean we would, have to write $.get('phpfile.php')
within the script and one can say that voa he is using PHP hmmmm.
Simply, I want to ask is there is any way of loading a PHP through request without advertising your technology as above told.
Some coding will be honored.
In by debugger process, by using ptrace(PT_STEP,childPid,0,0), tell the OS to restart the child process, but stop it after it executes the next instruction.
But seems that the result is not right. Child process do not executes the next instruction,but in my debugger process, i called wait(&statue) after the call:ptrace(PT_STEP,childPid,0,0).
wait(&wait_status);
while (WIFSTOPPED(wait_status)) {
if (ptrace(PT_STEP, child, 0, 0) < 0) {
perror("ptrace");
return;
}
wait(&wait_status);
//Read the data using vm_read at address:0x10046 in process debugie's memory space,compare with the orig value.
//But, the new value is always same as the orig value!!!
}
In debugie process, i set: data= data*10; the data's address is 0x10046.
After several steps,the new value should be different from the orig value, i changed data's value several time in debugie process.
I test it on Mac os x, but it's a virtual machine(Virtual Box).
999 to 999
1000 to 1k
1500000 to 1.5m
and so on, I would like to not lose any precision at all
Also, need to convert them back to their original value
1.5m to 1500000
etc
The highest it would go is 11 digits max
Thanks